Thread: Cross platform char to wstring.

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    97

    Cross platform char to wstring.

    I need to convert a char[1024] to an STL wstring. I'm aware that I can do that using MultiByteToWideChar in Windows but I'm looking for a cross platform solution (at least Windows and Linux). Is there any function in the C++ ISO standard that can do that?

    Thanks in advance

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Look up the <cwchar> header.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    97
    For those wondering or people that later search for a solution to this problem, I used the mbstowcs function which seems to be cross platform.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  2. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  3. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM