Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » cout, cin etc. question
cout, cin etc. question [message #15235] Fri, 11 April 2008 09:19 Go to next message
exhu is currently offline  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 Go to previous messageGo to next message
mirek is currently offline  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... Smile

Mirek
Re: cout, cin etc. question [message #15244 is a reply to message #15241] Fri, 11 April 2008 14:49 Go to previous messageGo to next message
exhu is currently offline  exhu
Messages: 12
Registered: April 2008
Location: Belarus
Promising Member
Well, actually unicode in console is a very rare use case. It is just related to the bug report I posted about command line arguments being not unicode and I wanted to print it to the console and thus found out that console output is not unicode aware as well Smile So I don't think it is of great importance.
Re: cout, cin etc. question [message #15752 is a reply to message #15235] Wed, 07 May 2008 04:32 Go to previous message
tvanriper is currently offline  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.
Previous Topic: Understanding pick behaviour and containers
Next Topic: int16 support in Value?
Goto Forum:
  


Current Time: Sat Apr 27 03:08:07 CEST 2024

Total time taken to generate the page: 0.04588 seconds