HP 9000 User Manual page 95

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

6
Using Flexible Formatting.
The flexible formatting feature enables you to read
and write order-sensitive information for different locales. Examples of such
order-sensitive information include:
• Relative position of day and month in date.
• Position of the currency symbol.
• Radix symbol.
For instance, to print a locale-specific version of the date include the following
statement in your program:
printf((catgets(nlmsg,NL_SET,3,"%1$d%2$d/%3$d")), month,day,yr)
To handle the differences in conventions, each message catalog contains the
specific formatting option needed. For example, to print the date, an american
locale catalog contains the formatting string:
1 The date is: %1$d/%2$d/%3$d
A German catalog contains:
1 Heute ist: %2$d.%1$d.%3$d
Suppose month = 1 (Jan), day
=
25, and year = 90 (1990). If LANG=german, the
following is printed:
25.1. 90
If LANG=american, then the following is printed:
1/25/90
If LANG is not set or if catopen failed during program initialization, the default
string included in the call to catgets is used.
Note
It
is enough to understand the general principle of flexible
formatting here. The specifics of messaging are explained in
Chapter 7 and flexible formatting is explained in greater detail
in Chapter 8.
6-18
Developing International Software

Advertisement

Table of Contents
loading

Table of Contents