⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iconv.3

📁 libiconv是一个很不错的字符集转换库。程序接口也很简单
💻 3
字号:
.\" Copyright (c) Bruno Haible <bruno@clisp.org>.\".\" This is free documentation; you can redistribute it and/or.\" modify it under the terms of the GNU General Public License as.\" published by the Free Software Foundation; either version 2 of.\" the License, or (at your option) any later version..\".\" References consulted:.\"   GNU glibc-2 source code and manual.\"   OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html.\".TH ICONV 3  "January 21, 2004" "GNU" "Linux Programmer's Manual".SH NAMEiconv \- perform character set conversion.SH SYNOPSIS.nf.B #include <iconv.h>.sp.BI "size_t iconv (iconv_t " cd ,.BI "              const char* * " inbuf ", size_t * "inbytesleft ,.BI "              char* * " outbuf ", size_t * "outbytesleft );.fi.SH DESCRIPTIONThe argument \fIcd\fP must be a conversion descriptor created using thefunction \fBiconv_open\fP..PPThe main case is when \fIinbuf\fP is not NULL and \fI*inbuf\fP is not NULL.In this case, the \fBiconv\fP function converts the multibyte sequencestarting at \fI*inbuf\fP to a multibyte sequence starting at \fI*outbuf\fP.At most \fI*inbytesleft\fP bytes, starting at \fI*inbuf\fP, will be read.At most \fI*outbytesleft\fP bytes, starting at \fI*outbuf\fP, will be written..PPThe \fBiconv\fP function converts one multibyte character at a time, and foreach character conversion it increments \fI*inbuf\fP and decrements\fI*inbytesleft\fP by the number of converted input bytes, it increments\fI*outbuf\fP and decrements \fI*outbytesleft\fP by the number of convertedoutput bytes, and it updates the conversion state contained in \fIcd\fP.The conversion can stop for four reasons:.PP1. An invalid multibyte sequence is encountered in the input. In this caseit sets \fBerrno\fP to \fBEILSEQ\fP and returns (size_t)(-1). \fI*inbuf\fPis left pointing to the beginning of the invalid multibyte sequence..PP2. The input byte sequence has been entirely converted, i.e. \fI*inbytesleft\fPhas gone down to 0. In this case \fBiconv\fP returns the number ofnon-reversible conversions performed during this call..PP3. An incomplete multibyte sequence is encountered in the input, and theinput byte sequence terminates after it. In this case it sets \fBerrno\fP to\fBEINVAL\fP and returns (size_t)(-1). \fI*inbuf\fP is left pointing to thebeginning of the incomplete multibyte sequence..PP4. The output buffer has no more room for the next converted character. Inthis case it sets \fBerrno\fP to \fBE2BIG\fP and returns (size_t)(-1)..PPA different case is when \fIinbuf\fP is NULL or \fI*inbuf\fP is NULL, but\fIoutbuf\fP is not NULL and \fI*outbuf\fP is not NULL. In this case, the\fBiconv\fP function attempts to set \fIcd\fP's conversion state to theinitial state and store a corresponding shift sequence at \fI*outbuf\fP.At most \fI*outbytesleft\fP bytes, starting at \fI*outbuf\fP, will be written.If the output buffer has no more room for this reset sequence, it sets\fBerrno\fP to \fBE2BIG\fP and returns (size_t)(-1). Otherwise it increments\fI*outbuf\fP and decrements \fI*outbytesleft\fP by the number of byteswritten..PPA third case is when \fIinbuf\fP is NULL or \fI*inbuf\fP is NULL, and\fIoutbuf\fP is NULL or \fI*outbuf\fP is NULL. In this case, the \fBiconv\fPfunction sets \fIcd\fP's conversion state to the initial state..SH "RETURN VALUE"The \fBiconv\fP function returns the number of characters converted in anon-reversible way during this call; reversible conversions are not counted.In case of error, it sets \fBerrno\fP and returns (size_t)(-1)..SH ERRORSThe following errors can occur, among others:.TP.B E2BIGThere is not sufficient room at \fI*outbuf\fP..TP.B EILSEQAn invalid multibyte sequence has been encountered in the input..TP.B EINVALAn incomplete multibyte sequence has been encountered in the input..SH "CONFORMING TO"UNIX98.SH "SEE ALSO".BR iconv_open "(3), " iconv_close (3)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -