The ifx_gl_wcsntslen() function
The ifx_gl_wcsntslen() function determines the number of characters in a wide-character string.
Syntax
#include <ifxgls.h>
...
int ifx_gl_wcsntslen(wcs, wcs_char_length)
gl_wchar_t *wcs;
int wcs_char_length;
- wcs
- A pointer to the wide-character string whose length the function determines.
- wcs_char_length
- The integer number of characters in the wcs string. If wcs_char_length is the value IFX_GL_NULL, the function assumes that wcs is a null-terminated string.
Valid in client application | Valid in DataBlade® UDR |
---|---|
Yes | Yes |
Usage
The ifx_gl_wcsntslen() function returns the number of characters in wcs, not including the trailing-space characters. The trailing-space characters are all characters that the blank character class of the current locale defines.
Space
characters that are embedded in the string at any place except the
end of the string are included in the count. For example, the following
call to ifx_gl_wcsntslen() return a value of 4
(the number of wide characters in the string A1A2B1B2s1s2C1C2,
where A1A2, B1B2, and
C1C2 are wide characters of 2 bytes each, and
s1s2 is the wide-character blank space):
ifx_gl_wcsntslen("A1A2B1B2s1s2C1C2s1s2s1s2s1s2", wcs_char_length)
Use the ifx_gl_wcntslen() function if you want the length without trailing white space.
Return values
- >=0
- The number of characters in the wcs string, not including any trailing space.
- -1
- The function was not successful, and the error number is set to indicate the cause. See the Errors section.
Errors
If an error occurred, this function
returns -1 and sets the ifx_gl_lc_errno() error
number to the following value.
- IFX_GL_PARAMERR
- The wcs_char_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.