Wednesday, November 09, 2005

printf(_"string") - What does that "_" mean?

Most of us might have encountered a code like the one mentioned above. What does this mean? Goooogling gave me its meaning.

Actually, a macro by name _(str) will be defined as follows:
#define _(str) gettext(str)

What gettext() does?

The gettext function translates the "str" from the natural language message into the user's language by looking up the translation in a message catalog.
From this, what I understand is, suppose I am using Latin language in my machine. And the string "str" is in English. So whenever printing, the gettext() translates English to Latin gives it to printf(). So I'll be seeing the messages in Latin.

Hope Microsoft also uses a similar kind of macro "_T" for displaying strings in multi-byte format.

1 comment:

Photography said...

nice blog. thanks