readv&writev函数
来源:互联网 发布:厦门西岐网络 编辑:程序博客网 时间:2024/06/05 05:50
#include <stdio.h>#include <sys/uio.h>#define BUF_SIZE 100int main(){struct iovec vec[2];char buf1[BUF_SIZE]={0,};//char buf2[BUF_SIZE]={0,};//int str_len;vec[0].iov_base=buf1;vec[0].iov_len=5;vec[1].iov_base=buf2;vec[1].iov_len=BUF_SIZE;str_len=readv(0,vec,2);//readv函数的第一个参数为0,因此从标准输入接收数据printf("Read bytes: %d \n",str_len);printf("First message: %s \n",buf1);printf("Second message: %s \n",buf2);return 0;}
#include <stdio.h>#include <sys/uio.h>/*struct iovec{void *iov_base;//指向一个char数组size_t iov_len;//大小};*/int main(int argc,char *argv[]){struct iovec vec[2];char buf1[]="ABCDEFG";char buf2[]="1234567";int str_len;vec[0].iov_base=buf1;vec[0].iov_len=3;vec[1].iov_base=buf2;vec[1].iov_len=4;str_len=writev(1,vec,2);//调用writev()函数puts("");printf("Write bytes: %d \n",str_len);return 0;}
阅读全文
0 0
- readv/writev 函数
- readv/writev 函数
- readv()和writev()函数
- readv和writev函数
- readv&writev函数
- 函数readv 和函数writev
- readv/writev
- writev与readv
- readv/writev系统调用
- readv/writev系统调用
- 【Linux】readv与writev
- readv与writev
- 【Linux】readv与writev
- 套接字API(十二)readv和writev函数
- 《UNIX环境高级编程》笔记--readv和writev函数
- 网络编程学习笔记(readv和writev函数)
- unix 网络 编程 readv writev
- readv和writev简单实现
- 算法谜题81 再论名人问题
- Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
- JNI调用VC++代码
- 数字图像处理实验(15):PROJECT 06-02,Pseudo-Color Image Processing
- qt+qwt
- readv&writev函数
- Python2和3的字符串编码差别
- bzoj 4713: 迷失的字符串 (树形DP+bitset)
- Qt学习笔记(1) — 深入了解Hello World的创建过程
- LeetCode 260. Single Number III (数组查重)
- 2pointer + 双端队列 计算区间max-min在一定范围的子数组个数
- POJ 1505 Copying Books 笔记
- sqlite进入 ...> 状态退出的方法
- 在一个地铁车站