Re: CString help
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Thu, 21 Jun 2007 16:12:05 -0500
jp2code wrote:
Wow! Thanks gang! I had 27 occurrences of "GetBuffer(0)" in my code, and not one call to ReleaseBuffer.
That's fixed now, though.
I have a little Borland background. There, I had to use AnsiString (like std::string) and I accessed the data using AnsiString::c_str(). When I first started using VC, GetBuffer looked like Msft's equivalent. Wrong! :)
I don't know Borland, but I would imagine that AnsiString::c_str() returns const char*. CString::GetBuffer() returns char* (in ANSI build), a string whose contents you can modify.
CString::GetBuffer() can increase efficiency in some situations, but is best avoided, IMHO. You will notice that std::string has no such mechanism.
--
David Wilkinson
Visual C++ MVP
.
- Follow-Ups:
- Re: CString help
- From: Mihai N.
- Re: CString help
- References:
- CString help
- From: jp2code
- Re: CString help
- From: Ajay Kalra
- Re: CString help
- From: jp2code
- CString help
- Prev by Date: Re: TRACE with VS6 onVista
- Next by Date: MFC Project with /clr and CWinFormsControl
- Previous by thread: Re: CString help
- Next by thread: Re: CString help
- Index(es):