当 readv() 时候,需要程序自己提供space,接收数据。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/uio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h> int main()
{
int ret;
int fd;
char str0[];
char str1[];
struct iovec iov[]; fd = open("./tmp", O_RDWR);
if (fd < ) {
perror("open");
return -;
}
#if 0
read(fd, str0, sizeof(str0));
printf("%s\n", str0);
close(fd);
return ;
#endif
memset(str0, , sizeof(str0));
memset(str1, , sizeof(str1));
iov[].iov_base = str0;
iov[].iov_len = sizeof(str0);
iov[].iov_base = str1;
iov[].iov_len = sizeof(str1); ret = readv(fd, iov, );
if (ret < ) {
perror("readv");
close(fd);
return -;
} sleep();
printf("...%s\n", str0);
printf("...%s\n", str1);
sleep(); ret = writev(STDOUT_FILENO, iov, );
if (ret < ) {
perror("writev");
close(fd);
return -;
} close(fd);
return ;
}

最新文章

  1. C# 利用反射给不同类型对象同名属性赋值
  2. SQL 常用语句
  3. 【代码笔记】iOS-对iphone手机进行判断的一些函数
  4. 【BZOJ-2721】樱花 线性筛 + 数学
  5. uva.10020 Minimal coverage(贪心)
  6. Request.Form()的使用
  7. 用Jquery load text文本到網頁遇到的問題
  8. Glossary of view transformations
  9. stdcall与cdecl的区别
  10. 729 - The Hamming Distance Problem
  11. Sublime Text 中使用Git插件连接GitHub
  12. Unity3D之资源问题处理
  13. HTML5 文件域+FileReader 分段读取文件并上传(八)-WebSocket
  14. Cells(Rows.Count, 1).End(xlUp).Row的含义
  15. iOS开发之监听键盘高度的变化 分类: ios技术 2015-04-21 12:04 233人阅读 评论(0) 收藏
  16. 在Azure上部署带有GPU的深度学习虚拟机
  17. JWebFileTrans(JDownload): 一款可以从网络上下载文件的小程序(二)
  18. mn
  19. python 函数指动态形参,作用域
  20. JavaScript大杂烩6 - 理解JavaScript中的this

热门文章

  1. VUE 关于理解$nextTick()的问题
  2. backdoor-factory
  3. 五、Singleton 单例模式
  4. verilog之inout
  5. CentOS 7系统根目录分区扩容
  6. 153. Find Minimum in Rotated Sorted Array (Array; Divide-and-Conquer)
  7. selector 选择器
  8. 对stm32f373XX的startup.s的文件的分析
  9. 我的tensorflow学习1
  10. java 线程Thread 技术--1.5 Future与Callable