I am working on C++ MFC project build in unicode settings and I usually use function _ttof
to convert CString
to double but i couldn't find a function for long double
which use TCHAR
.
Thanks in advance.
I am working on C++ MFC project build in unicode settings and I usually use function _ttof
to convert CString
to double but i couldn't find a function for long double
which use TCHAR
.
Thanks in advance.
You'll most likely find that for targets that are relevant to Microsoft Foundation Classes, long double
and double
are the same size.
Therefore you can build your own function stub, (which calls _ttof
) with a static assertion sizeof(double) == sizeof(long double)
just to be on the safe side:
static_assert(sizeof(double) == sizeof(long double), "double and long double are not the same size");
Use
Format
method ofCString
class: