Archived

This topic is now archived and is closed to further replies.

What is _T ??

This topic is 5110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

quote:
Original post by huahsin68
Hi!!

I have a sample here: _T("XXX")

What is the purpose of _T ?
Is it a function?

Thank You @!


It''s a text macro which converts the following character or string to unicode if _UNICODE is defined.



Human beings, by changing the inner attitudes of their minds, can change the outer aspects of their lives.

William James (1842 - 1910)

Share this post


Link to post
Share on other sites
Unicode allows for any reasonable language to be encoded without mucking with string sizes or multi-byte business. Win2K/XP is Unicode natively (though the Win32 API provides ASCII calls, which usually convert to Unicode on entry). _T translates to L if _UNICODE is defined, or nothing if not. C/C++ spec provides that a string that looks like L"I am your daddy" is stored in Unicode-compatible format (16 bits per character).

Similarly, TCHAR is the macro''d version of CHAR/WCHAR. LPCTSTR is the macro''d version of LPCSTR or LPCWSTR.

People should get used to using Unicode. I''m not sure if it''ll ever overtake single-byte character strings, but it''s certainly can''t hurt.

I like pie.

Share this post


Link to post
Share on other sites