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

T

terminatorul

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
 
R

Ron Natalie

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top