Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
main()
{
int fd1 = open("test1.tmp", O_RDWR|O_TRUNC|O_CREAT);
int fd2 = open("test2.tmp", O_RDWR|O_TRUNC|O_CREAT);
char buf[1024*1024];
if (fd1 < 0 || fd2 < 0) {
perror("open");
exit(1);
}
write(fd1, buf, 4096);
write(fd2, buf, sizeof(buf)-4096);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment