This has been asked millions of times before, I'm sure, but how do I turn a unsigned integer into a string, I'm using _utloa() function but it's not working. Am I doing something wrong?
Printable View
This has been asked millions of times before, I'm sure, but how do I turn a unsigned integer into a string, I'm using _utloa() function but it's not working. Am I doing something wrong?
Just use the itoa function. See the FAQ for an example.
I made a huge mistake in my 1st post, I mean an unsigned long into a string. I use the _utloa() and I get '!!!!!!!!!' or similar returned.
USe the sprintf() or wsprintf() functions.
Code:int n = 45;
LPSTR lpNum;
wsprintf(lpNum, "%d", n);
You need a real buffer, not just a pointer:Code:char pcBuf[10];
sprintf(pcBuf, "%d", number);
From this code
I'm getting ìììììììììììììììììììì in the szSectorsCode:char szSectors[10];
sprintf(szSectors, "%i", 10);
puts(szSectors);
I just tried that exact code and it printed "10" :confused:
Are we talking Console applications or
Windows Applications???
Does it matter??
ok. I'm getting 10ìììììììì now, is there a way to cut off the ììììììì's?
edited:
I'm being stupid now, I got it.
try this...
char szSectors[10];
memset(szSectors, 0, 10);
sprintf(szSectors, "%i", 10);
puts(szSectors);
or
char szSectors[10]=NULL;
sprintf(szSectors, "%i", 10);
puts(szSectors);