computer_knowledge_notes/Languages/CLang/libraries/iconv.md

24 lines
739 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 概述
用于将一种字符集转换成另一种字符集。
iconv的意思可能是Identifier for conversion用于转换的标识符
```c
/* 实现字符集的转换
* cd转换描述符由iconv_open函数生成
* inbuf输入序列的指针
* inbytesleft输入序列的字节数
* outbuf输出序列的指针
* outbytesleft输出序列的字节数
*/
size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
/* 分配一个转化描述符使得可以把字符序列从编码fromcode转化为编码tocode */
iconv_t iconv_open(const char *tocode, const char *fromcode);
/* 释放用于字符集转换的描述符cd */
int iconv_close(iconv_t cd);
```