The ifx_gl_mbscoll() function

The ifx_gl_mbscoll() function uses locale-specific order to compare two multibyte-character strings.

Syntax

#include <ifxgls.h>
...
int ifx_gl_mbscoll(mbs1, mbs1_byte_length, mbs2, mbs2_byte_length)
       gl_mchar_t *mbs1;
       int mbs1_byte_length;
       gl_mchar_t *mbs2;
       int mbs2_byte_length;
mbs1
A pointer to the multibyte-character string to compare with mbs2.
mbs1_byte_length
The integer number of bytes in the mbs1 string. If mbs1_byte_length is the value IFX_GL_NULL, the function assumes that mbs1 is a null-terminated string.
mbs2
A pointer to the multibyte-character string to compare with mbs1.
mbs2_byte_length
The integer number of bytes in the mbs2 string. If mbs2_byte_length is the value IFX_GL_NULL, the function assumes that mbs2 is a null-terminated string.
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_mbscoll() function uses locale-specific order to compare the multibyte-character strings mbs1 and mbs2.

Locale information

The LC_COLLATE category of the current locale affects the behavior of this function because it defines the locale-specific order.

Return values

<0
The mbs1 string is less than the mbs2 string (mbs1 < mbs2); or the function was not successful, and the error number is set to indicate the cause. See the Errors section.
=0
The mbs1 string is equal to the mbs2 string (mbs1 = mbs2).
>0
The mbs1 string is greater than the mbs2 string (mbs1 > mbs2).

Errors

This function does not return a unique value to indicate an error. If an error occurred, this function returns -1 and sets the ifx_gl_lc_errno() error number to one of the following values.
IFX_GL_PARAMERR
Either mbs1_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to 0, or mbs2_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.
IFX_GL_TERMMISMAT
Either mbs1_byte_length is equal to IFX_GL_NULL, and mbs2_byte_length is greater than or equal to 0; or mbs1_byte_length is greater than or equal to 0, and mbs2_byte_length is equal to IFX_GL_NULL.
IFX_GL_EILSEQ
Either mbs1 or mbs2 contains an invalid multibyte character.
IFX_GL_EINVAL
Either the function cannot determine whether the last character of mbs1 is a valid multibyte character because it would need to read more than mbs1_byte_length bytes from mbs1, or the function cannot determine whether the last character of mbs2 is a valid multibyte character because it would need to read more than mbs2_byte_length bytes from mbs2.
IFX_GL_ENOMEM
Not enough memory is available to complete the operation.