J
Jeffrey Walton
Hi All,
I'm attempting to write a wstring to a file by way of wofstream. I'm
getting compression on the stream (I presume it is UTF-8). How/where
do I invoke an alternate constructotor so that the stream stays wide
(UTF-16)?
I suspect that it is hidden in a locale, but I don't have much
experience with them. I also have not been able to locate it in
Stroustrup: Appendix D: Locales [1]. [1] does state the following, but
I do not have section 21.7: "Section §21.7 describes how to change
locale for a stream; this appendix describes how a locale is
constructed out of facets and explains the mechanisms through which a
locale affects its stream."
== Sample ==
wstring ws = L"wide";
wofstream ofs;
ofs.open("wide.dat", std::ios::binary | std::ios::trunc );
if( !ofs.good() ) { return; }
ofs << ws;
ofs.close();
== End Sample ==
Thanks,
Jeff
Jeffrey Walton
[1] http://www.research.att.com/~bs/3rd_loc0.html
I'm attempting to write a wstring to a file by way of wofstream. I'm
getting compression on the stream (I presume it is UTF-8). How/where
do I invoke an alternate constructotor so that the stream stays wide
(UTF-16)?
I suspect that it is hidden in a locale, but I don't have much
experience with them. I also have not been able to locate it in
Stroustrup: Appendix D: Locales [1]. [1] does state the following, but
I do not have section 21.7: "Section §21.7 describes how to change
locale for a stream; this appendix describes how a locale is
constructed out of facets and explains the mechanisms through which a
locale affects its stream."
== Sample ==
wstring ws = L"wide";
wofstream ofs;
ofs.open("wide.dat", std::ios::binary | std::ios::trunc );
if( !ofs.good() ) { return; }
ofs << ws;
ofs.close();
== End Sample ==
Thanks,
Jeff
Jeffrey Walton
[1] http://www.research.att.com/~bs/3rd_loc0.html