![]() I have found a sample about using CStdioFile. ![]() At the very least, this is a jarring inconsistency, as CString can contain UNICODE, and ofstream canĪccept CString input, for example: CString Test = _T("abc") The fact that FILE supports UNICODE, UTF-8 & UTF-16, while ofstream does not is a clear indication that VS does not, yet, fully support UNICODE. In addition to this modification, I had to ensure that the file was explicitly closed, as ofstream files are closed automatically when the deconstructor is called, but FILE files are not! I also was able to remove the code to write BOM to the file,Īs this is automatic with FILE when css=UNICODE or UTF-8 or UTF-16. The basic idea is to open the file with: FILE *fStream Įrrno_t e = _tfopen_s(&fStream, TargetFile, _T("wt,ccs=UTF-8")) ĪfxMessageBox(_T("Export file cannot be opened"), MB_ICONINFORMATION) ĬStdioFile File(fStream) // open the file from this stream Full disclosure, a coworker pointed me to this solution, which he obtained from StackOverflow: As it turns out, the answer is fairly simple, as I expected it should be.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |