Re: Copy to CString's internal buffer

Tech-Archive recommends: Speed Up your PC by fixing your registry



#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS

"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message
news:uLaJQ3BtHHA.1216@xxxxxxxxxxxxxxxxxxxxxxx
Joseph M. Newcomer wrote:

CString str(buffer, 20);
doesn't require the intermediate copy, and allows extraction of an
arbitrary field as I
show earlier.

Hi Joe:

Ah yes, I see that this works in VS2002 and later. In VC6, the conversion
constructor only exists for the one-parameter constructor, which requires
a NUL-terminated string.

However, I personally dislike these CString conversion constructors, and I
would never write code that depended on them. In fact I have modified my
VC6 CString headers to eliminate them (and I would do it in the later
templated versions if I could figure out how).

--
David Wilkinson
Visual C++ MVP


.



Relevant Pages

  • Re: Copy to CStrings internal buffer
    ... and allows extraction of an arbitrary field as I ... In VC6, the conversion constructor only exists for the one-parameter constructor, which requires a NUL-terminated string. ... However, I personally dislike these CString conversion constructors, and I would never write code that depended on them. ... In fact I have modified my VC6 CString headers to eliminate them. ...
    (microsoft.public.vc.mfc)
  • Re: Copy to CStrings internal buffer
    ... conversion constructor only exists for the one-parameter constructor, ... However, I personally dislike these CString conversion constructors, and ... my VC6 CString headers to eliminate them (and I would do it in the later ...
    (microsoft.public.vc.mfc)