Cross platform char to wstring.

This is a discussion on Cross platform char to wstring. within the C++ Programming forums, part of the General Programming Boards category; I need to convert a char[1024] to an STL wstring. I'm aware that I can do that using MultiByteToWideChar in ...

  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,796
    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, 09: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, 12:58 PM
  5. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 09:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21