Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)?

This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are so many variations regarding the referencing of char and tchar.

like image 522
CrashCodes Avatar asked Oct 01 '08 20:10

CrashCodes


Video Answer


2 Answers

The simplest way is to use the conversion macros:

  • CW2A
  • CA2W
  • etc...

MSDN

like image 200
RichS Avatar answered Sep 20 '22 18:09

RichS


MultiByteToWideChar but also see "A few of the gotchas of MultiByteToWideChar".

like image 29
jeffm Avatar answered Sep 23 '22 18:09

jeffm