Archived

This topic is now archived and is closed to further replies.

pan narrans

Data Conversion - aaaargh!

Recommended Posts

I have a value (long FPS) that I need to pass to a PrintToScreen function that accepts char * (PrintToScreen(char *)). Unfortunately, I''m rubbish at converting data values and the VC++ help files are hard to navigate if you don''t know exactly what you are looking for. I tried passing (char*)&FPS but the result was gibberish. I suspect this is because I am converting the type but not the actual data stored in memory. For instance, if FPS is 30, I need the char value to be "30". I know the answer will probably be simplistic but I would appreciate any help. Cheers, pan narrans

Share this post


Link to post
Share on other sites
You need to convert your long into a string (array of characters).

This can be done using sprintf or itoa, which you should be able to type in, highlight, and press F1 to get help on.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites