[RESOLVED] How to use wchar_t[] array with std::wstring
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] How to use wchar_t[] array with std::wstring

  1. #1
    Join Date
    Jan 2010
    Posts
    75

    [RESOLVED] How to use wchar_t[] array with std::wstring

    Hi Experts;

    I am trying to learn C++ and make use of its standard library instead of using the standard C library which i know all to well.

    Can anyone tell me the best way of working with std::wstring and wchar_t arrays.

    For example:
    Code:
    std::vector<std::wstring> vstring;
    std::wstring wstring;
    	
    wchar_t msg[] = L"Hello";
    
    /* std::wstring Not compatible with push_back */
    wstring.push_back(msg);
    
    /* std::wstring Assigned works! */
    wstring = msg;
    
    /* std::vector is compatible with push back */
    vstring.push_back(msg);
    
    /* std::vector assigned not compatible */
    vstring = msg;
    Looking forward to your reply's!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,000

    Re: How to use wchar_t[] array with std::wstring

    How about just read the documentation about std::wstring and std::vector?
    Victor Nijegorodov

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