How to tell if standard input is UNICODE or ANSI text ?

Discussion in 'C++' started by terminatorul@gmail.com, Jan 30, 2008.

  1. Guest

    Hello

    Sorry if asking a known question.
    I have a program that reads lines of text from standard input and
    writes the non-empty ones back to standard output.
    In most cases it will be used with standard input and output streams
    redirected to FS files.

    If my input is wide-character (UNICODE) I would like to use wcin and
    wcout and write wide-character text to standard output. If my input is
    narrow-character I would like to use cin and cout to write narrow-
    character text to standard output.

    How can I tell if my standard input stream has UNICODE text ?

    Thank you,
    Timothy Madden,
    Romania
     
    , Jan 30, 2008
    #1
    1. Advertising

  2. Ron Natalie Guest

    wrote:

    > How can I tell if my standard input stream has UNICODE text ?
    >

    What makes you think that wcin has anything to do with UNICODE.
    C++ places no such constraint.

    You can't tel for sure but there are definite clues. If you
    would google
    first bytes of unicode file
    you'll find what they are. Open the file, read the first few
    bytes and see if they match.
     
    Ron Natalie, Jan 30, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    521
  2. Replies:
    11
    Views:
    1,124
    Keith Thompson
    Apr 28, 2008
  3. Dietrich Bollmann
    Replies:
    0
    Views:
    383
    Dietrich Bollmann
    Apr 22, 2008
  4. たか
    Replies:
    2
    Views:
    602
    たか
    May 29, 2008
  5. Frank Iannarilli

    pre-ansi to ansi c++ conversion?

    Frank Iannarilli, Jul 21, 2009, in forum: C++
    Replies:
    2
    Views:
    442
Loading...

Share This Page