diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/utilities.cpp b/utilities.cpp index 8320d93..322541a 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -476,14 +476,17 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU } DeleteFile(path_out.c_str()); path_out += _T(".asc"); - f.open(path_out.c_str(), std::ios::in); + f.open(path_out.c_str(), std::ios::in | std::ios::ate); wstring data; - while(!f.eof() && f.is_open()) + if(f.is_open()) { - TCHAR tmp[128]; - f.getline(tmp, 128); + std::ifstream::pos_type size = f.tellg(); + TCHAR *tmp = new TCHAR [(std::ifstream::pos_type)size+(std::ifstream::pos_type)1]; + f.seekg(0, std::ios::beg); + f.read(tmp, size); + tmp[size]= '\0'; data.append(tmp); - data.append(_T("\n")); + delete [] tmp; } DeleteFile(path_out.c_str()); if(data.find(_T("-----BEGIN PGP MESSAGE-----")) != wstring::npos && data.find(_T("-----END PGP MESSAGE-----")) != wstring::npos) |