#include<stdio.h> #include <fcntl.h> int main() { int fd1 = open("f1.txt", O_RDONLY); if (fd1 = = -1) { perror("c1"); exit(1); } printf("opened the fd = % d\n", fd1); // Using close system Call if (close(fd1) = = -1) { perror("c1"); exit(1); } printf("closed the fd.\n"); 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