天天看点

fd读写文件

int read_fd;

int write_fd;

//1打开文件,读取utf-8文件

read_fd=open("utf8.txt",O_RDONLY|O_CREAT);

write_fd=open("gbk.txt", O_WRONLY|O_CREAT);

char utfBuffer[256] = {0};

size_t inLen = read(read_fd, utfBuffer, 256);

ret = write(write_fd, szDest, 256-outLen);

close(read_fd);

close(write_fd);

     本文转自fengyuzaitu 51CTO博客,原文链接:http://blog.51cto.com/fengyuzaitu/1571332,如需转载请自行联系原作者

继续阅读