Re: Playing with CString and LPSTR, PLEASE HELP !!
Well, I stand corrected. I never knew this. I always assumed I was supposed to supply the minimum size I expected the resulting string to be, so I supplied the maximum size expected to be safe. I guess _I_ should have examined the MFC; but then who wants nightmares?
The point is, in Braulio's example, as the resulting string may have been longer than the original the parameter to GetBuffer() should have been the maximum size expected, which I think (s)he has now done.
Re: Playing with CString and LPSTR, PLEASE HELP !!
> I guess _I_ should have examined the MFC; but then who wants nightmares?
:-) Actually, once you learn to skip the ASSERTs and conditional compilation stuff, most of the MFC code isn't too bad. It's the Windows framework stuff that's really complex...
> The point is, in Braulio's example, as the resulting string may have been longer than the original the parameter to GetBuffer()
> should have been the maximum size expected, which I think (s)he has now done.
Yes, that's right.
Dave