write

PHOTO EMBED

Thu Jun 06 2024 20:44:10 GMT+0000 (Coordinated Universal Time)

Saved by @prabhas

#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;
}
content_copyCOPY