First of all I am less informed than a "beginner". I have a program that was written for me several years ago and I no longer have acces to the programmer. There is on small portion that does not work correctly and I would like to try to change it myself. I can compile it using Visual Studio 2008.
Here is the code. This is not the complete program, only the part that isn't working:
double fInches;
// Grab the input string into something useful
CString strTemp(szIiSs);
strTemp.Trim();
// Now the math -- convert the string to fractional inches
// Grab the portion before the decimal
int iStart = 0;
CString strToken = strTemp.Tokenize(_T("."), iStart);
fInches = fabs(_tcstod(strToken, NULL));
// And after
if (iStart > -1)
{
strToken = strTemp.Tokenize(_T("."), iStart);
// More addition
fInches += _tcstod(strToken, NULL) / 16.0;
}
The problem is if I use the string ".12" it returns 12 instead of 0.75, (12/16).
If I use the string "0.12" it works correctly and returns 0.75.
Again, I do not know how to program so what I need is actual code that fixes the problem. An explanation would fall on ignorant eyes here but might help someone else.
Thanks