[Bug c++/54527] New: wcout breaks on win32 console
vurentjie at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 8 14:13:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54527
Bug #: 54527
Summary: wcout breaks on win32 console
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: vurentjie@gmail.com
this case does not seem to work...
the wide character does not print, nor does the "...done" part,
this is only an issue for windows console...
#include <windows.h>
#include <iostream>
int main(int argc, char** argv){
SetConsoleOutputCP(1200);
wchar_t out[3]={0,0x000a,wchar_t()};
int characters = 1000;
while(characters--){
out[0]=wchar_t(characters);
std::wcout << out << "...done";
}
}
...this case does work however, and where no glyph is found for the character
the square replacement is used
#include <windows.h>
#include <iostream>
int main(int argc, char** argv){
SetConsoleOutputCP(1200);
wchar_t out[10]={0,0x000a,'.','.','.','d','o','n','e',wchar_t()};
int characters = 1000;
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD n;
while(characters--){
out[0]=wchar_t(characters);
WriteConsoleW( stdout, out, 10, &n, NULL );
}
return 0;
}
i am not sure if this has anything to do with the default locale,
or how to fix it without resorting to windows-specific api instead of
std::wcout
More information about the Gcc-bugs
mailing list