MFC String: How to convert a 'char*' to 'CString'?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: MFC String: How to convert a 'char*' to 'CString'?

Threaded View

  1. #1
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443

    MFC String: How to convert a 'char*' to 'CString'?

    Q: How to convert a 'char*' to 'CString'?

    A: Use either the constructor of 'CString' or its assigment operator:

    Code:
    char* str = "Hello";
    CString cs(str);
    or

    Code:
    CString cs;
    cs = str;

    Last edited by Andreas Masur; July 24th, 2005 at 11:43 AM.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center