Calling GetBuffer is not a good solution in this case, even if you call ReleaseBuffer afterward. There's no need to use GetBuffer because CString already defines casting operators (which returns the same type of what GetBuffer returns, so it depends on the UNICODE settings). Using GetBuffer is very bad practice and should be avoided.
You are writing a UNICODE string to the file. Each AppendChar() converts the character to a UNICODE character and appends it to the string. During your write, you'll also note that only half the string is being written. (CString::GetLength() returns the number of characters, not the number of bytes.)
[sajad@sajad Desktop]$ g++ c++file.cpp
c++file.cpp: In function ‘int main(int, char**)’:
c++file.cpp:66: error: ‘struct std::_List_iterator<code_ch>’ has no member named ‘begin’
c++file.cpp:66: error: ‘struct std::_List_iterator<code_ch>’ has no member named ‘end’
oh sorry ,it is a part of huge program so i only copy it and no member is in the list.but when i fix it and add:
code_ch *h=new code_ch;
yet the same problem.
Last Visit: 29-Mar-20 15:41 Last Update: 29-Mar-20 15:41