#include<stdio.h> #include <fcntl.h> Int main( ) { int sz; int fd = open("f1.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd ==-1) { perror("r1"); exit(1); } sz = write(fd, "hello linux", strlen("hello linux")); printf("called write(%d, \"hello linux\", %d). It returned %d\n", fd, strlen("hello linux"), sz); close(fd); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter