Home » U++ Library support » U++ Core » cout, cin etc. question
cout, cin etc. question [message #15235] |
Fri, 11 April 2008 09:19 |
exhu
Messages: 12 Registered: April 2008 Location: Belarus
|
Promising Member |
|
|
Does U++ library contain stdout, stdin, stderr as FileStream classes?
If not, then how to use the U++ classes to do stdin/out via Stream classes in order to use proper charset (e.g. WIDE char under WinXP) because standard library (in case of MSVC) uses ANSI charset for cin, cout?
Thanks in advance!
|
|
|
Re: cout, cin etc. question [message #15241 is a reply to message #15235] |
Fri, 11 April 2008 14:02 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
exhu wrote on Fri, 11 April 2008 03:19 | Does U++ library contain stdout, stdin, stderr as FileStream classes?
|
Cout()
Cerr()
instead of Cin stream, there is
String ReadStdIn();
(reads single input line).
Quote: |
If not, then how to use the U++ classes to do stdin/out via Stream classes in order to use proper charset (e.g. WIDE char under WinXP) because standard library (in case of MSVC) uses ANSI charset for cin, cout?
|
Oh, actually, I did not even knew that you can do or bother with UNICODE in console...
Mirek
|
|
|
|
Re: cout, cin etc. question [message #15752 is a reply to message #15235] |
Wed, 07 May 2008 04:32 |
|
tvanriper
Messages: 85 Registered: September 2007 Location: Germantown, MD, USA
|
Member |
|
|
In Windows, the console can be relatively easily Unicode-aware under an NT-derived OS.
Instead of std::cout/std::cin/std::cerr, you'd use std::wcout/std::wcin/std::wcerr.
Typically, I like to have some header file with something like the following:
#ifdef UNICODE
#define Tcout std::wcout
#define Tcin std::wcin
#define Tcerr std::wcerr
#else // UNICODE
#define Tcout std::cout
#define Tcin std::cin
#define Tcerr std::cerr
#endif // UNICODE
In this way, I can use the standard stream classes for working with TCHARs (again, in Windows). I've done this with a number of console applications in the past.
I don't know as much about U++ in these regards, though.
|
|
|
Goto Forum:
Current Time: Sat Apr 27 03:08:07 CEST 2024
Total time taken to generate the page: 0.04588 seconds
|