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

    Getting character string from CString object

    Hi Gurus ,
    I'm having one CString object in which i'm having one string . I want to
    concatenate that string with some other string .
    Even i've tried with CString:perator LPCTSTR(). But giving error like
    unable to convert from "const char*" to "char*".

    A code illustrated below ,

    strcat(m_FileEdit.operator LPCTSTR(),".bmp");//m_FileEdit is CString object

    Moreover i want to convert this string to character string .
    Otherwise even it will work, if somebdy tells me how to retrieve string
    inside CString object as a character string .

    Thanks in advance !


  2. #2
    Join Date
    May 1999
    Posts
    25

    Re: Getting character string from CString object

    m_FileEdit+=".bmp";
    then do a strcpy into a char variable


  3. #3
    Join Date
    May 1999
    Posts
    82

    Re: Getting character string from CString object

    I believe you could just use something like this

    m_FielEdit += ".bmp";

    then if you need a char* string you can use something like this

    char* str = m_FileEdit.GetBuffer(-1);




  4. #4
    Join Date
    May 1999
    Posts
    156

    Re: Getting character string from CString object

    Hi,

    I normally do strcpy(char *Des, (LPCSTR) strSource)

    Will


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