Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:44:39+00:00 2026-05-27T03:44:39+00:00

I want to know the reason why there are macros such as T, TEXT,

  • 0

I want to know the reason why there are macros such as T, TEXT, _TEXT, __TEXT or __T when they all ultimately do the same thing.

i.e.

mapping “string” to L”string” if UNICODE is defined.

Thanks for the answers. On a more practical approach, can somebody explain me the behavior of the code given below?

#include <stdio.h>
#include <conio.h>
#include <tchar.h>   // For _T and _TEXT
#include <windows.h> // For __TEXT 

int __cdecl main ()

{

  printf ("%s", _TEXT(__FILE__ ));  // Works fine

  printf ("%s", _T(__FILE__));      // Works fine

  printf ("%s", __TEXT(__FILE__ )); // error C2065: 'L__FILE__': undeclared identifier

  _getwch();

}

Update:
I think my code has something to do with C preprocessor tokenization. I am posting a separate question for that. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:44:40+00:00Added an answer on May 27, 2026 at 3:44 am

    As it is often the case with "arcane" things, Raymond Chen gives some information (emphasis added):

    So what’s with all these different ways of saying the same thing?
    There’s actually a method behind the madness.

    The plain versions without the underscore affect the character set the
    Windows header files treat as default
    . So if you define UNICODE, then
    GetWindowText will map to GetWindowTextW instead of GetWindowTextA,
    for example. Similarly, the TEXT macro will map to L"..." instead of
    "...".

    The versions with the underscore affect the character set the
    C runtime header files treat as default
    . So if you define _UNICODE,
    then _tcslen will map to wcslen instead of strlen, for example.
    Similarly, the _TEXT macro will map to L"..." instead of "...". What
    about _T? Okay, I don’t know about that one. Maybe it was just to save
    somebody some typing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know all the possible uses of cookies. Are they good or
I just want to know is whether there is any reason/story behind to use
I'm making a chat responder for a game and i want know if there
I want to know if there is any kind of report on maven that
Ok so I want to know how <% using (Html.BeginForm()) { %> <input type=text
In IIS6 was there a reason for using ISAPI filters/ extensions?. Can the same
I want to know how to publish from PowerShell the same way I can
I want to know what is the easiest way to export ALL content of
I want to have more control over macros such as assertions (and some logging
I know it has a good reason, but I want to know what reason?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.