You want
m_strLine.Replace("\n", "\r\n");
>> m_strLine.Replace ( '\n' ,'\r\n' );
That should give you a warning or two, are you ignoring compiler warnings?
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
Alright, then wrap the string literals with the _T() macro (from ), like so;
m_strLine.Replace(_T("\n"), _T("\r\n"));
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
>>cannot covert from const char [2] to wchar_t
Hummm. If you are compiling the program for UNICODE then why aren't you getting similar errors on all the other lines in your program (such as line 5)?
You could have avoided that problem altogether had you used ifstream and getline() instead of C's FILE and associated C functions.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>> If you are compiling the program for UNICODE then why aren't you getting similar errors on all the other lines in your program (such as line 5)?
fopen() is the non-UNICODE version, so the code is valid as such - although it is confusing. One option would be to completely stick with MFC i.e. using CStdioFile/CString for reading the file.
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395