diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-07 15:08:02 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-07 15:08:02 +0300 |
commit | 461183308684de712dc674382a86f87707a19a2a (patch) | |
tree | c14e09ff9dbb7a85d2e07d6f4703baf7365472f7 /messages.cpp | |
parent | 41fd4b79199e9779842ae544855fd50a8b269121 (diff) |
modified: messages.cpp
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/messages.cpp b/messages.cpp index 05b7862..27c31fb 100644 --- a/messages.cpp +++ b/messages.cpp @@ -298,25 +298,22 @@ int RecvMsgSvc(WPARAM w, LPARAM l) wstring path = tmp2; mir_free(tmp2); path += _T("\\decrypted_data"); - fstream f(path.c_str(), std::ios::in); - while(!f.eof() && f.is_open()) + fstream f(path.c_str(), std::ios::in | std::ios::binary); + while(f.is_open()) { char tmp[256]; - f.getline(tmp, 256); - TCHAR *tmp2; -// if(unicode) - tmp2 = mir_utf8decodeW(tmp); -// else -// tmp2 = mir_a2t(tmp); - if(!tmp2) + f.getline(tmp, 255); + if(strlen(tmp) == 0) break; + TCHAR *tmp2; + tmp2 = mir_utf8decodeW(tmp); str.append(tmp2).append(_T("\n")); mir_free(tmp2); } f.close(); DeleteFile(path.c_str()); str.erase(str.find_last_of(_T("\n")), 1); - if(!str.length()) + if(str.empty()) { string str = pre->szMessage; mir_free((void**)pre->szMessage); |