简短的说:从不连续的地方读/写字符串
转载出处:http://blog.csdn.net/joeblackzqq/article/details/8352086
代码出处:
附代码:
/*
* 将三个独立的字符串一次写入终端。*
* */
#include
int main(int argc,char **argv)
{
char part1[] = "This is iov";
char part2[] = " and ";
char part3[] = " writev test";
struct iovec iov[3];
iov[0].iov_base = part1;
iov[0].iov_len = strlen(part1);
iov[1].iov_base = part2;
iov[1].iov_len = strlen(part2);
iov[2].iov_base = part3;
iov[2].iov_len = strlen(part3);
writev(1,iov,3);
return 0;
}
输出结果:
This is iov and writev test
阅读(1530) | 评论(0) | 转发(0) |