Actually first let's do event handling. This adds a ftoutf16() function we can use here.

This commit is contained in:
Pietro Gagliardi 2016-05-17 12:35:44 -04:00
parent 027bb6782b
commit 473e0c9b69
2 changed files with 13 additions and 0 deletions

View File

@ -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

View 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());
}