Jan 3rd, 2003, 04:00 AM
#1
Thread Starter
Addicted Member
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
Jan 3rd, 2003, 07:08 AM
#2
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.
Jan 3rd, 2003, 08:37 AM
#3
Thread Starter
Addicted Member
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
Jan 3rd, 2003, 11:13 AM
#4
This is possible.
Here's a header file that does the same thing for all streams and for strings too.
Attached Files
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width