Actually first let's do event handling. This adds a ftoutf16() function we can use here.
This commit is contained in:
parent
027bb6782b
commit
473e0c9b69
|
@ -37,6 +37,7 @@ extern WCHAR *strf(const WCHAR *format, ...);
|
|||
extern WCHAR *vstrf(const WCHAR *format, va_list ap);
|
||||
extern char *LFtoCRLF(const char *lfonly);
|
||||
extern void CRLFtoLF(const char *s);
|
||||
extern WCHAR *ftoutf16(double d);
|
||||
|
||||
// debug.cpp
|
||||
// see http://stackoverflow.com/questions/14421656/is-there-widely-available-wide-character-variant-of-file
|
||||
|
|
|
@ -128,3 +128,15 @@ void CRLFtoLF(char *s)
|
|||
while (t != s)
|
||||
*t++ = '\0';
|
||||
}
|
||||
|
||||
// std::to_string() always uses %f; we want %g
|
||||
// fortunately std::iostream seems to use %g by default so
|
||||
WCHAR *ftoutf16(double d)
|
||||
{
|
||||
std::wostringstream ss;
|
||||
std::wstring s;
|
||||
|
||||
ss << d;
|
||||
s = ss.str(); // to be safe
|
||||
return utf16dup(s.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue