Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
4.20/5 (5 votes)
See more:
the size of buffer through API returned descriped in MSDN,sometimes in character, sometimes in TCHARs, could you tell me the different between in characters and in TCHARs(on UNICODE project or on multibyte project).
Posted
Updated 25-Mar-11 9:30am
v2
Comments
Richard MacCutchan 25-Mar-11 13:40pm    
I don't know who voted this down or why; it seems a perfectly reasonable question.
Nuri Ismail 25-Mar-11 14:00pm    
Yes, you are right Richard. His question is reasonable.

Maybe the fact that the answer could be easily found with a simple search motivated this down-vote, but the question is not a code request, therefore IMHO it does not deserve this down-vote.

I'll try to compensate with a 5, too.
Albert Holguin 25-Mar-11 21:34pm    
my 5

Have a look at this[^] nice CP Tip/Trick. TCHAR is well explained there. :)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Mar-11 15:31pm    
Seems to be a good reference. These types is a permanent source of confusion. My 5.
--SA
Nuri Ismail 25-Mar-11 17:41pm    
Thank you, SA.
Albert Holguin 25-Mar-11 21:10pm    
great link!
Albert Holguin 25-Mar-11 21:12pm    
to supplement the answer.... a lot of times when you see a name with all caps, as in TCHAR, its an indication of a macro
[no name] 26-Mar-11 0:11am    
Good link
TCHAR is defined as char in a non-Unicode project, and as WCHAR (16 bit character) in a Unicode project. This allows the same code to be ported from non-Unicode to Unicode fairly easily.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Mar-11 15:31pm    
Correct, my 5.
--SA
For the first: TCHAR is not a type themselves - its a placeholder for the character type you use. This can be:
* unicode characters (unsigned short or wchar_t)
* ANSI characters (char).
this depends on your project settings. You can plan your module to support both of them. Therefore you have to generate a project configuration for each. But now what can do TCHAR for you? if you use TCHAR as type for character or string operations you can compile both versions in the same way. The only thing you have to is to include <tchar.h> that maps (#define) the necessary function for you.
i.e.:
* _tcscmp: strcmp or wcscmp
* _tcslen: strlen or wcslen
* and so on.
Regards.
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 25-Mar-11 15:33pm    
Correct, my 5.
--SA
[no name] 26-Mar-11 0:12am    
Qiut interesting

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



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