LPTSTR to float
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
try using atof function
-
try using atof function
-
_tstof() doesn't work. C:\Projects\PCnt\XLConvDlg.cpp(835) : error C2065: '_tstof' : undeclared identifier Thx
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
paper67 wrote:
Is there any way to convert from a LPTSTR to a float value.
what about
_tcstod
function"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV -- modified at 6:54 Tuesday 6th December, 2005
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
How about the old standby,
sscanf
? There is also a wide-character version,swscanf
. If you've eliminated the whitespace around the string-represented floating-point value, then the following will work:// input: CString sData
float fValue;
// sscanf will return the number of items pulled out of the string
int nResult = sscanf((LPCTSTR)sData, "%f", &fValue);
if( nResult != 1 )
{
// Didn't find a floating-point value. Take corrective action...
}Bob Ciora
-
I am using VC 6.0. I am writing an MFC application where I use strings with the _T("") macro.(Character set neutral). Is there any way to convert from a LPTSTR to a float value. I noticed that the function _ttof does not exist in VC 6.0. Does anybody know how this conversion can be done. Thx.
-
paper67 wrote:
Is there any way to convert from a LPTSTR to a float value.
what about
_tcstod
function"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV -- modified at 6:54 Tuesday 6th December, 2005