Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link
Posts

Mohan

0 min read

#include<stdio.h>

#include <fcntl.h>

int main()

{

int fd1 = open("foo.txt", O_RDONLY);

if (fd1 < 0)

{

perror("c1");

exit(1);

}

printf("opened the fd = % d\n", fd1);

// Using close system Call

if (close(fd1) < 0)

{

perror("c1");

exit(1);

}

printf("closed the fd.\n");

}

Output:

opened the fd = 3

closed the fd.

You may like these posts

  • ChatBot ::-webkit-scrollbar{ width:0; } *{ margin:0; padding:0; box-sizing:border-box; } body{ width:100vw; he…
  • Connect Volunteers with Nonprofits /* CSS styles */ body { font-family: Arial, sans-serif; background-color: #f2f2f2; } …
  •  [18/07, 10:39 am] Nagarjuna Cse❤️: #include<stdio.h>#include<conio.h>struct process { int at,ts,st,ft,wait,ts2,ta; float nta;}p[20];main() { int i,…
  • #include<stdio.h> main() { int i,a=1,h=2,n; printf("\n Enter the no of jobs"); scanf("%d",&n); for(i=0;i<n;i++) { if(a==1) { printf("processing %d......! \n", i+1);a++…
  •  ....................................,,,,,,,...................................................................................................................................…
  • #include<stdio.h>#include <fcntl.h>int main(){int fd1 = open("foo.txt", O_RDONLY);if (fd1 < 0){perror("c1");exit(1);}printf("opened the fd = % d\n", fd1);// Using cl…

Post a Comment