The problem with iconv() is that it is not part of the C standard, but is specified in two different standards. One of them is POSIX-1.2008 :
#include <iconv.h> size_t iconv(iconv_t cd, char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft);
Another SUSv2 :
#include <iconv.h> size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
They differ in const n **inbuf , so if you want to remain portable between both standards, you will unfortunately need to pass a non-constant **inbuf .
Edit:. Since this is a double pointer, the problem is even worse, see my answer here . In a nutshell, these specifications are incompatible in any direction ...
What you linked as โdocument of iconvโ is the GNU libiconv documentation, which is intended to be used on platforms that iconv() does not initially provide โ this obviously follows SUSv2 .
The header file that you find on your system refers to glibc , your C platform library and this implementation complies with the POSIX-1.2008 specification .
source share