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

    Quick question on const char[] to wstring

    Hello,
    I am wondering if I have the following parameter to pass in to a function
    Code:
    void Load(std::wstring filename);
    This statement is wrong.
    Code:
    Load("Data\\Mesh.x");
    I don't want to pre-declare a variable. How do I directly pass a wstring (literal) to this function.
    Sorry, Don't know if this is specific to Visual C++ where I am using
    Thanks
    Jack

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,721

    Re: Quick question on const char[] to wstring

    Code:
    Load(L"Data\\Mesh.x");
    Also, if you do not change filename, you should pass by const reference, not by value.

  3. #3
    Join Date
    Dec 2010
    Posts
    907

    Re: Quick question on const char[] to wstring

    Thanks, they all fixed.

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