DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Complying with standard C

New functions

Certain locale-dependent capabilities were added as new standard functions. Besides setlocale which allows control over the locale itself, the Standard includes the following new functions:

localeconv numeric/monetary conventions
strcoll collation order of two strings
strxfrm translate string for collation
strftime formatted date/time conversion

and the multibyte functions previously discussed (mblen, mbtowc, mbstowcs, wctomb, and wcstombs).

The localeconv function returns a pointer to a structure containing information useful for formatting numeric and monetary information appropriate to the current locale's LC_NUMERIC and LC_MONETARY categories. (This is the only function whose behavior depends on more than one category.) For numeric values the structure describes the decimal-point character, the thousands separator, and where the separator(s) should be located. There are fifteen other structure members that describe how to format a monetary value!

The strcoll function is analogous to the strcmp function except that the two strings are compared according to the LC_COLLATE category of the current locale. As this comparison is not necessarily as inexpensive as strcmp, the strxfrm function can be used to transform a string into another, such that any two such after-translation strings can be passed to strcmp and get an ordering analogous to what strcoll would have returned if passed the two pre-translation strings.

The strftime function provides a sprintf-like formatting of the values in a struct tm, along with some date and time representations that depend on the LC_TIME category of the current locale. This function is based on the ascftime function released as part of UNIX® System V Release 3.2.


Next topic: Grouping and evaluation in expressions
Previous topic: Changed functions

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004