473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Underscore in fprintf argument

Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone explain
what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.

Nov 14 '05 #1
7 1549
mattman wrote:
Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone explain
what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive,
No.
or am I missing something obvious?


It's likely that there is a macro called simply _ defined somewhere
else in the source code, as in...

#define _(x) x /* or something more */

But the best place to ask about Linux/GnuC programming and source
are the linux and Gnu newsgroups.

--
Peter

Nov 14 '05 #2
"mattman" <ma*******@hotmail.com> writes:
Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone explain
what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.


It's not predefined. A single underscore is just an identifier; the
program, or some library it uses, probably defines it as a function or
macro. (I think it's commonly used by some internationalization
package; _() probably returns a translation of the message.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #3
mattman wrote:
Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone explain
what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.


let's get this out of the way fist: GNU or gcc-specific questions belong
in a GNU or gcc-specific newsgroup.

The answer to your question is to be found in the code, probably in
header files. You will probably find a macro definition for _(x).
Nov 14 '05 #4
On Fri, 11 Mar 2005 15:57:55 -0800, mattman wrote:
fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.


Typical idiom used to identify translatable strings for
internationalization (I18N) tools such as "gettext".

Cheers!

Nov 14 '05 #5
Martin Ambuhl wrote:
mattman wrote:
Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone
explain what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.


let's get this out of the way fist: GNU or gcc-specific questions
belong in a GNU or gcc-specific newsgroup.

The answer to your question is to be found in the code, probably in
header files. You will probably find a macro definition for _(x).


He didn't ask a GNU or gcc-specific question. He asked a C
question, and incidentally mentioned what sort of system he was
using and his experience. There is no need to jump down his throat
about it, especially with your fist :-)

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #6
CBFalconer wrote:
Martin Ambuhl wrote:
mattman wrote:

Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone
explain what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.


let's get this out of the way fist: GNU or gcc-specific questions
belong in a GNU or gcc-specific newsgroup.

The answer to your question is to be found in the code, probably in
header files. You will probably find a macro definition for _(x).

He didn't ask a GNU or gcc-specific question. He asked a C
question, and incidentally mentioned what sort of system he was
using and his experience. There is no need to jump down his throat
about it, especially with your fist :-)


I have not trimmed any of the exchange because had I done so, I would
have been charged with hiding parts that support Mr Falconer's claim.
Anyone with the ability to read can plainly see that I did not jump down
the OP's throat, much less with my fist. Mr Falconer has clearly got
his head up his butt.
Nov 14 '05 #7
Martin Ambuhl wrote:
CBFalconer wrote:
Martin Ambuhl wrote:
mattman wrote:

Very new to GNU-Linux C programming, so I'm not as good at finding
answers to things like this as I want to be ... could someone
explain what the underscore is in the following:

fprintf (stderr, _("Try `%s --help' for more information.\n"),
programName);

Is it a preprocessor directive, or am I missing something obvious?
Probably both. This is my first post, so be gentle.

let's get this out of the way fist: GNU or gcc-specific questions ^^^^ belong in a GNU or gcc-specific newsgroup.

The answer to your question is to be found in the code, probably in
header files. You will probably find a macro definition for _(x).


He didn't ask a GNU or gcc-specific question. He asked a C
question, and incidentally mentioned what sort of system he was
using and his experience. There is no need to jump down his throat
about it, especially with your fist :-)


I have not trimmed any of the exchange because had I done so, I would
have been charged with hiding parts that support Mr Falconer's claim.
Anyone with the ability to read can plainly see that I did not jump down
the OP's throat, much less with my fist. Mr Falconer has clearly got
his head up his butt.


See underlined verbiage above, which triggered the whole thing.
You are taking this far too seriously. The OP also appears to be a
reasonable, if uninformed, sort.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hpy_awad | last post by:
formatting float variables to fprintf has error to my writing to output file called rental and I do not the reason that a rabish is written to the file instead of the actual input screen values ? ...
2
by: Marco | last post by:
Hi all, I saw the following line in a C source. what's the asterisk * mean? Thank you! fprintf(conn_out, "%.*s\r\n", (int)(strlen(buf + 1) - 1), buf + 1);
11
by: nertos | last post by:
Why doesn't this fragment work? FILE *file; fopen(argv, "r+"); fprintf(file, "\b"); THX nertos
7
by: jchludzinski | last post by:
I tryin' to print out a string with a variable number of blanks/spaces preceding the string. I know that if I use: fprintf( stdout, "%12s", string ); I get 12 blanks preceding 'string'. If I...
8
by: Bill Pursell | last post by:
This question must be FAQ, but I can't find it: I'm baffled by the following: $ cat a.c #define foo(x) foo##x_ #define bar(x) bar##x##_ foo() foo(1) bar()
4
by: grimrob | last post by:
fprintf just is not working. I am using PHP Version 4.3.9. Whatever I do fprintf just fails. For example: fwrite($Handle, 'A1'); fprintf($Handle, 'A2); The first line always works, the...
16
by: Prayag Narula | last post by:
Hi, I want to redefine fprintf for debugging purposes. That is I want that all the output that is going to the stdout should be logged in a file. I tried something like #define fprintf...
11
by: David Mathog | last post by:
In the beginning (Kernighan & Ritchie 1978) there was fprintf, and unix write, but no fwrite. That is, no portable C method for writing binary data, only system calls which were OS specific. At...
9
by: Skye | last post by:
What is this doing? print >fd, _(__doc__) I'm guessing line-splitting __doc__ into a list, but what's that leading underscore do? Thanks!
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.