Click here to Skip to main content
Sign Up to vote bad
good
See more: C++MFCATL
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 25 Mar '11 - 6:56
Edited 25 Mar '11 - 9:30

Comments
Richard MacCutchan - 25 Mar '11 - 13:40
I don't know who voted this down or why; it seems a perfectly reasonable question.
Nuri Ismail - 25 Mar '11 - 14:00
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:34
my 5

3 solutions

Have a look at this[^] nice CP Tip/Trick. TCHAR is well explained there. Smile | :)
  Permalink  
Comments
SAKryukov - 25 Mar '11 - 15:31
Seems to be a good reference. These types is a permanent source of confusion. My 5. --SA
Nuri Ismail - 25 Mar '11 - 17:41
Thank you, SA.
Albert Holguin - 25 Mar '11 - 21:10
great link!
Albert Holguin - 25 Mar '11 - 21:12
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
santosh dhanawade - 26 Mar '11 - 0:11
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.
  Permalink  
Comments
SAKryukov - 25 Mar '11 - 15:31
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.
  Permalink  
Comments
SAKryukov - 25 Mar '11 - 15:33
Correct, my 5. --SA
santosh dhanawade - 26 Mar '11 - 0:12
Qiut interesting

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 586
1 Maciej Los 255
2 Slacker007 240
3 Aarti Meswania 233
4 OriginalGriff 230
0 Sergey Alexandrovich Kryukov 9,118
1 OriginalGriff 7,134
2 CPallini 3,803
3 Rohan Leuva 3,135
4 Maciej Los 2,558


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 25 Mar 2011
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid