cs_strbuild

Description

Constructs native language message strings.

Syntax

CS_RETCODE cs_strbuild(context, buffer, buflen,
             resultlen, text, textlen 
             [, formats, formatlen]
             [, arguments]);
 
 CS_CONTEXT    *context;
 CS_CHAR         *buffer;
 CS_INT             buflen;
 CS_INT             *resultlen;
 CS_CHAR        *text;
 CS_INT             textlen;
 CS_CHAR         *formats;        /* Optional */
 CS_INT             formatlen;       /* Optional */
 <optional arguments>

Parameters

context

A pointer to a CS_CONTEXT structure.

buffer

A pointer to the space in which cs_strbuild places the finished message. Note that the finished message is not null-terminated. An application must use *resultlen to determine the length of the message placed in *buffer.

buflen

The length, in bytes, of the *buffer data space.

resultlen

A pointer to an integer variable. cs_strbuild sets *resultlen to the length, in bytes, of the string placed in *buffer.

text

A pointer to the unfinished text of the message. The *text string contains message text and placeholders for variables. A placeholder has the form %integer!, for example, %1!, %2!, and so forth. The integer indicates which argument to substitute for a particular placeholder. Arguments are numbered from left to right.

textlen

The length, in bytes, of *text. If *text is null-terminated, pass textlen as CS_NULLTERM.

formats

A pointer to a string containing one sprintf-style format specifier for each place holder in the *text string.

formatlen

The length, in bytes, of *formats. If *formats is null-terminated, pass formatlen as CS_NULLTERM.

arguments

The values which will be converted to character according to the *formats string and substituted into the *text string to produce the message that is placed in *buffer.

There must be one argument for each place holder. The first value corresponds to the first format and the %1! placeholder, the second value corresponds to the second format and the %2! placeholder, and so forth.

If insufficient arguments are supplied, cs_strbuild generates unpredictable results.

If too many arguments are supplied, the excess arguments are ignored.

Returns

cs_str_build returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Usage

See also

cs_dt_crack, cs_dt_info, cs_locale