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 and the multibyte functions previously discussed (mblen(), mbtowc(), mbstowcs(), wctomb(), and wcstombs()):

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

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 function ascftime(S).

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

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003