Here's the code I worte. It works but the text from the file is put into the edit in one big block. How could I modify it to solve the problem?
Code:BOOL ReadIntoEdit(HWND hwndEdit, PTSTR pstrFileName) { ifstream in(pstrFileName); if (!in) { MessageBox (NULL, "File could not be read." , "Error!", 0 | MB_ICONHAND | MB_SETFOREGROUND); return FALSE; } string fileContents, line; while(getline(in, line)) fileContents += line + "\n"; char *convertedContents; convertedContents = new char[fileContents.size()+1]; fileContents.copy(convertedContents,fileContents.size()); SetWindowText(hwndEdit, convertedContents); return TRUE; }



LinkBack URL
About LinkBacks


