CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    44

    operator LPCTSTR

    Hi!

    How do I have to use this string operator?
    I have a CString object i.e. "s" and now I want to access the characters stored in this object.
    I do not want to use the member function "GetBuffer( )".

    Thanx in advance...
    Normen

    --
    apartis AG http://www.apartis.de
    Normen Mueller

  2. #2
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    Re: operator LPCTSTR

    like this :

    LPCTSTR lpTest = (LPCTSTR) MyCString;

    It's a cast-operator.


  3. #3
    Join Date
    May 1999
    Posts
    21

    Re: operator LPCTSTR

    If you feel more comfortable with C style of accessing strings, cast it to char type first.
    E.g.

    CString s="My String";
    char *cpBuffer;

    cpBuffer=new char[s.GetLength()+1];
    strcpy(cpBuffer, (LPCTSTR)s);
    ... // do character by character access
    delete []cpBuffer;



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured