Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fstream unicode

Status
Not open for further replies.

RwDwR

Programmer
Aug 1, 2002
16
NL
Hi,

I have a two part C++ question:

1, I am using fstream to output stuff to a file, however, fstream appends, not clear the opened files content first, I can't find a function which does this, any thoughts?

2, I must use unicode, but as it seems the fstream doesn't use unicode, can this be set in some way? I really really need unicode...

Thanks for the help
 
found the answer to part 1;
ofstream fout( "results.txt", ios::eek:ut ) ;
instead of
ofstream fout( "results.txt", ios::app) ;
which obviously appends, but I got the abr. wrong, and thought it meant something else....

I still need the answer to nr 2!!!!!!!!!!!!!!!!!!!!!!!
 
If you are writing to a file in unicode you want to use

putws or anything with a w in it. Also, you can use CFile which should be FULLY UNICODE compliant and Write out TCHARS.

This should get you started.

If need be you can go to the API calls for WideCharToMultiByte and vice versa.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top