lost the leading 0, help
I was hoping someone could help me find a 0 in a string.
I'm trying to read a drive's serial number and store it as a string.
char serial ="";
The only problem is, I know that the serial number starts with a 0 and the proggy isn't storing that first 0.
I believe the number is there, but it's the way you are reading the var that hides it.
For C++ numbers that start with a 0 are considered in octal format.
You may want to cast dwSerial before passing it to ultoa
Actually... I think that what I said doesn't make any sense at all :rolleyes:
This is the prototype for ultoa
char* ultoa( unsigned long int value, char* buffer, int radix );
So basically you need to check if an implicit cast is happening when you pass dwSerial into ultoa.
Grrr... the second time I edit this message...
I think i found your problem. You are using ultoa with base 16. If you want to convert dwSerial to a string that reads the serial number as is, you need to change the base to 10