Archived

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

pan narrans

Data Conversion - aaaargh!

Recommended Posts

pan narrans    1284
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
pan narrans    1284
I knew it would be simple:

char buffer[3];
_itoa( FPS, buffer, 10 );
PrintToScreen( buffer );

Just posted the solution in case anyone ever searches for it

Thanx siaspete

Share this post


Link to post
Share on other sites