473,796 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1575
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*******@hotm ail.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 internationaliz ation
package; _() probably returns a translation of the message.)

--
Keith Thompson (The_Other_Keit h) 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
internationaliz ation (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********@yah oo.com) (cb********@wor ldnet.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********@yah oo.com) (cb********@wor ldnet.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
9529
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 ? #include <stdio.h> //part09_le01_file_processing_file_setup_ver_01_iti_r01_ch09.c struct name { int int___member1; float float_member2; char char__member3;
2
2678
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
444
by: nertos | last post by:
Why doesn't this fragment work? FILE *file; fopen(argv, "r+"); fprintf(file, "\b"); THX nertos
7
1417
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 use: n = 12; fprintf( stdout, "%(n)s: ", string );
8
1459
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
2717
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 second always fails. Likewise any other example.
16
6709
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 (x,y,z) my_fprintf(x,y,z)
11
4307
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 C89 fwrite/fread were added to the C standard to allow portable binary IO to files. I wonder though why the choice was made to extend the unix function write() into a standard C function rather than to extend the existing standard C function...
9
1114
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
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.