开发者

To convert Datatype "WORD" into char*

I have to convert word datatype into char* to pass in a function. Could anyone show me how to do it. IT should be in C and not C++.

Also I nee开发者_JAVA百科d to pass into function something like 2000-3000-2 where 2000 = word datatype 3000 = word datatype 2 = word and "-" while function takes char* as an argument.

so basically i need to convert above combination of word datatype into char*.

Any help or criticism will be helpful


You are looking for sprintf(), perhaps something like this:

sprintf(buffer, "%.4d-%.4d-%d", w1, w2, w3);

where w1, w2 and w3 are integer variables holding values 2000, 3000 and 2 in your example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜