#include #include #include #include using namespace std; int main() { int fd; int flags; int i; mode_t mode; flags = O_WRONLY | O_TRUNC | O_CREAT; mode = S_IRUSR | S_IWUSR | S_IROTH | S_IRGRP; fd = open("output2",flags, mode); for(i = 0; i < 10; i++) { write(fd, &i, sizeof(int)); } close(fd); return 0; }