Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > G

gettxt(3C)

TO BE OBSOLETED
HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

gettxt() — read text string from message file

SYNOPSIS

#include <unistd.h>

char *gettxt(char *msg_id, char *def_str);

DESCRIPTION

The gettxt() routine retrieves a text string from a message file for the current locale.

msg_id has the following syntax:

msgfilename:msgnumber

where msgfilename is the name of the message file generated by mkmsgs(1). If msgfilename is NULL, gettxt() uses the message file specified in the last call to setcat(3C). msgnumber is the sequence number of the text string in the message file (the sequence begins at 1).

gettxt() returns the message

Message not found!!

under any of the following conditions:

  • msgfilename is an invalid message catalog name.

  • No catalog is specified in msg_id or through setcat(3C).

  • msgnumber is not a positive number.

  • No message could be retrieved and def_str is NULL.

EXTERNAL INFLUENCES

Environment Variables

gettxt() uses the environment variable LC_MESSAGES to determine the locale to use to search for the msgfilename message file. If LC_MESSAGES is not set, the environment variable LANG is used. If LANG is not set, the "C" locale will be used. The user can also change the locale via the setlocale(3C) routine.

If the msgfilename message file is not found in the specified locale or if the msgnumber is out of bounds, gettxt() attempts to retrieve the text string from the "C" locale. def_str is the string returned if a text string cannot be retrieved even from the "C" locale.

EXAMPLES

The following code fragments are equivalent:

gettxt("mytest:1", "my default message"); setcat("mytest"); gettxt(":1", "my default message");

WARNINGS

Obsolescent Interfaces

gettxt() is to be obsoleted at a future date.

STANDARDS COMPLIANCE

gettxt(): SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.