#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <unistd.h>
#include<stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
int fd =open ("abc",O_RDWR|O_CREAT,0777);
if (fd==-1)
{
perror("open fd");
return -1;
}
lseek(fd ,20,SEEK_SET);
char *buf="hello";
write (fd,buf ,strlen(buf));
close (fd);
return 0;
}
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <unistd.h>
#include<stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
int fd =open ("abc",O_RDWR|O_CREAT,0777);
if (fd==-1)
{
perror("open fd");
return -1;
}
lseek(fd ,20,SEEK_SET);
char *buf="hello";
write (fd,buf ,strlen(buf));
close (fd);
return 0;
}