H
hamishd
I have some texts files, which i want to read in each line, and then
write back each line to a new text file.
So for example, I want to read in the 2 lines below:
"C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8
"",0,0,0,318.592,83.04552
I store each line of data in the following vector:
std::vector<CString> FileData;
So FileData[0] = ""C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8"
FileData[1] = """,0,0,0,318.592,83.04552"
(the data is in the vector correctly)
Then I go to write the data to a new text file...
FILE * stream;
stream = _wfopen(filename, _T("w"));
for(j=0;j<FileData.size();j++)
fwprintf(stream, _T("%s"), FileData[j]);
fclose(stream);
However, when I look at the text file, it's gone wrong:
C:\Data\,0,0,0,318.592,83.0455
I'm doing this in unicode. Is there any obvious problem?
write back each line to a new text file.
So for example, I want to read in the 2 lines below:
"C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8
"",0,0,0,318.592,83.04552
I store each line of data in the following vector:
std::vector<CString> FileData;
So FileData[0] = ""C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8"
FileData[1] = """,0,0,0,318.592,83.04552"
(the data is in the vector correctly)
Then I go to write the data to a new text file...
FILE * stream;
stream = _wfopen(filename, _T("w"));
for(j=0;j<FileData.size();j++)
fwprintf(stream, _T("%s"), FileData[j]);
fclose(stream);
However, when I look at the text file, it's gone wrong:
C:\Data\,0,0,0,318.592,83.0455
I'm doing this in unicode. Is there any obvious problem?