I need to be able to read/write to a file unicode strings that contain Chinese characters.
The documentation says that CFile::typeUnicode is "used in derived classes only", but I cannot find any reference to any derived class that does use it.
Is there any "official" version of CFile that will allow me to read and write unicode?
Or am I better off trying to use something like this: http://www.codeproject.com/Articles/4119/CStdioFile-derived-class-for-multibyte-and-Unicode
This seems to be an easier way: see How to Read and Write Text Files in Unicode through CStdioFile, it uses a
FILE
stream to open a file as Unicode and then opens aCStdioFile
class using that stream.You can also consider using a different class that does all of the hard work for you. I use CTextFileDocument:
CTextFileDocument class help topic
You can use the provided CTextFileWrite to write to a number of Unicode flavours. Example: