-
Using basic_ofstream
Is this right/OK/good/bad - whatever.
Code:
typedef basic_ofstream<TCHAR, char_traits<TCHAR> > tofstream;
I am trying to create an output stream that takes characters of type TCHAR (as you can guess). The question is, does this actually do this?
Thanks for your assistance.
HD
-
Yes, this will work, but if you use a tofstreaf, and UNICODE is defined, the output will not be an ASCII text file. If you write wchar_t characters to a file, they will be written as two bytes.
-
Am I correct in assuming that as long as I use the equivalent input stream (tifstream) then this wont matter?
My app needs to be localisable and therefore I required UNICODE support. TCHAR was suggested as the 'best' method of doing this.
HD
-
1 Attachment(s)
This is possible.
Here's a header file that does the same thing for all streams and for strings too.