Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,
I have two .cpp files under my "Windows Form Application project" say a.cpp and b.cpp . Character set in my "project prop->configuration->general->charecter set= Multibyte char support".
Now for a.cpp i want "Multibyte char support" (which is achieved from proj prop)
and for b.cpp i want "Unicode char support"
How can do both things simulteneously?
Posted

1 solution

There are two things to keep in mind when you are doing a "hybrid" app that deals with both ANSI and Unicode.

1. The data type - typically, you would want to use TCHAR, LPCTSTR, etc. But when you want to deal with ANSI, you can switch to using char.

2. The functions - for TCHAR data, use the the corresponding TCHAR functions: strlen --> _tcslen, etc. Some of the Win32 APIs also have two versions, A and W; example: GetFileAttributesA(), GetFileAttributesW().

As long as you keep these two things straight in your code, you should have no problems.
 
Share this answer
 
Comments
Albert Holguin 26-Apr-11 10:29am    
my 5, good answer hans
ganeshkawade2003 26-Apr-11 11:48am    
5 !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900