2
0
mirror of https://github.com/boostorg/nowide.git synced 2026-02-21 15:12:30 +00:00

Fix iostream output on older Windows

WriteConsoleW originally required the lpNumberOfCharsWritten argument.
That seems to have changed in later releases, but is required for
Windows Server 2003 and 2008. Fix a seg fault by passing the required
argument.
This commit is contained in:
Michael Smith
2015-12-07 10:39:52 -08:00
parent a711f32087
commit f2cda7a4a8

View File

@@ -64,8 +64,8 @@ namespace details {
namespace uf = boost::locale::utf;
char const *b = p;
char const *e = p+n;
DWORD size=0;
if(!isatty_) {
DWORD size=0;
if(!WriteFile(handle_,p,n,&size,0) || static_cast<int>(size) != n)
return -1;
return n;
@@ -81,7 +81,7 @@ namespace details {
}
if(c==uf::illegal)
return -1;
if(!WriteConsoleW(handle_,wbuffer_,out - wbuffer_,0,0))
if(!WriteConsoleW(handle_,wbuffer_,out - wbuffer_,&size,0))
return -1;
return decoded;
}