// C program to illustrate close system Call #include #include #include #include int main() { int fd1 = open("data.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644) ; int sz ; if (fd1 < 0) { perror("c1"); return(1); } printf("opened the fd = % d\n", fd1); sz = write(fd1, "hello class\n", strlen("hello class\n")); // Using close system Call if (close(fd1) < 0) { perror("c1") ; return(1) ; } printf("closed the fd.\n"); return( 0 ) ; }