Does Windows offer anything similar to writev in a non Cygwin environment?
Ideally, an answer would have a working example for windows, something along the lines of:
#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);
}
The answer should be how to approach the problem using system calls. Specifically I am looking to avoid copying the individual buffers into a single larger buffer to perform the write. Also the resultant write should be a single large write request instead of something like fwrite which performs buffered IO.
Edit: 13 August 12
The link to Scatter Gather I/O seems to pertain primarily to TCP/IP networking (err winsock really). Another suggestion, which is writefilegather is a solution for writing files in a very specific format. I.e. whereas writev writes using iov containers (arbitrary blocks of memory), writefilegather uses fixed buffers aligned to page table size.
WSASend function can send an array of WSABUF structures
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With