|
-
May 1st, 1999, 01:48 PM
#1
question about CStrings GetBuffer
Hi!
I used these lines of code to read a text file into a CString-object:
CString cstrFileBuffer;
LPSTR lpstrFileBuffer;
DWORD dwFileLength;
lpstrFileBuffer = cstrFileBuffer.GetBuffer ();
CFile file (cstrFileName, CFile::modeRead);
dwFileLength = file.GetLength ();
file.Read (lpstrFileBuffer, dwFileLength);
cstrFileBuffer.ReleaseBuffer ();
Well, this works in my case, but i was wondering if the GetBuffer()-function
does allocate the memory when calling it (without initializing the CString).
If not i might get some problems later on...
Can anybody tell me a more elegant and/or safer way to read in a text-file?!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|