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: unassig...@gcc.gnu.org
        ReportedBy: vurent...@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

Reply via email to