在windows上writev

Windows在非Cygwin环境中是否提供与writev类似的东西?

理想情况下,答案会有一个窗口的工作示例,大致如下:

#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/uio.h> int main() { struct iovec iov[2]; char blah[][20] = { "mickey", " mouse" }; int fd = open ("/tmp/mice.txt", O_WRONLY | O_CREAT); iov[0].iov_base=blah[0]; iov[1].iov_base=blah[1]; iov[0].iov_len=iov[1].iov_len=6; writev(fd, iov, 2 ); close(fd); } 

答案应该是如何使用系统调用来解决问题。 具体而言,我正在寻找避免将个别缓冲区复制到一个较大的缓冲区来执行写入。 此外,由此产生的写入应该是一个单一的大写请求,而不是类似执行缓冲IO的fwrite。


编辑 :12月13日

与Scatter Gather I / O的链接似乎主要涉及TCP / IPnetworking(真的是winsock)。 另一个build议是writefilegather,它是一个以非常特定的格式编写文件的解决scheme。 也就是说,writev使用iov容器(任意内存块)写入,writefilegather使用与页表大小alignment的固定缓冲区。

WSASend函数可以发送一个WSABUF结构数组