Alan
2010-01-01 10:06:01 UTC
I've just discovered a big in sscanf (I'm using C++ in VS 6.0). I'm trying to
read an integer from a CString. If there is a leading zero, the integer is
decoded incorrectly! For example, if the CString contains "60" it returns
integer 60 but if the CString contains "060" it returns integer 48! I've
searched the help file for any mention of prohibited leadign zeros but can't
find anything so I guess it's a bug in the Microsoft library function.
I'm using this to get information from a dialog, completed by a user.
sscanf(OptDlg.m_input, "%i", &Iret);
I can't control what users put in and a leading zero is valid in my book.
read an integer from a CString. If there is a leading zero, the integer is
decoded incorrectly! For example, if the CString contains "60" it returns
integer 60 but if the CString contains "060" it returns integer 48! I've
searched the help file for any mention of prohibited leadign zeros but can't
find anything so I guess it's a bug in the Microsoft library function.
I'm using this to get information from a dialog, completed by a user.
sscanf(OptDlg.m_input, "%i", &Iret);
I can't control what users put in and a leading zero is valid in my book.