public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vurentjie at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54527] New: wcout breaks on win32 console
Date: Sat, 08 Sep 2012 14:13:00 -0000	[thread overview]
Message-ID: <bug-54527-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-09-08 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08 14:13 vurentjie at gmail dot com [this message]
2012-09-08 14:19 ` [Bug c++/54527] " vurentjie at gmail dot com
2012-09-09  7:23 ` vurentjie at gmail dot com
2012-09-09  7:25 ` vurentjie at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-54527-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).