Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

iconv(3) OSS Library Calls Reference Manual
NAME
iconv - Converts a string of characters from one character code set to another character code set
LIBRARY
G-series native OSS processes: /G/system/sysnn/zicnvsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zicnvdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yicnvdll |
SYNOPSIS
#include <iconv.h>
size_t iconv(
iconv_t cd,
char **inbuf,
size_t *inbytesleft,
char **outbuf,
size_t *outbytesleft);
PARAMETERS
cd Specifies the conversion descriptor that points to the correct code set converter.
inbuf Points to a variable that points to the beginning of a buffer that contains the char-
acters to be converted.
inbytesleft Points to an integer that contains the number of bytes in inbuf still to be con-
verted.
outbuf Points to a variable that points to the buffer that contains the characters that have
been converted.
outbytesleft Points to an integer that contains the number of free bytes in outbuf.
DESCRIPTION
The iconv( ) function converts a string of characters in inbuf into a different code set and returns
the the results in outbuf. The required conversion method is identified by cd, which must be a
valid conversion descriptor returned by a previous successful call to the iconv_open( ) function.
On calling, the inbytesleft parameter indicates the number of bytes in inbuf to be converted and
outbytesleft indicates the number of available bytes in outbuf. These values are updated upon
return so they indicate the new state of their associated buffers.
RETURN VALUES
Upon successful conversion of all the characters in the inbuf buffer and placing the converted
characters in the outbuf buffer, the iconv( ) function returns the number of non-identical convers-
tions performed, updates inbytesleft and outbytesleft parameters, and increments the inbuf and
outbuf pointers. When the entire string in the input buffer is converted, the value pointed to by
inbytesleft will be zero. If it cannot convert all of the characters in the inbuf buffer, the iconv( )
function updates the inbytesleft (which will be nonzero) and outbytesleft parameters, returns
(size_t) - 1, and sets errno to indicate the error condition.
ERRORS
If any of the following conditions occur, the iconv( ) function sets errno to the corresponding
value.
[E2BIG] The outbuf buffer is too small to contain all the converted characters. The char-
acter that causes the overflow is not converted and inbytesleft indicates the bytes
left to be converted, including the character that caused the overflow. The inbuf
parameter points to the first byte of the characters left to convert.
42 Hewlett-Packard Company 527187-017