#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
int nread;
char buf[150];
int m,n,o;
m=open("kaha", O_RDONLY,S_IRUSR|S_IWUSR);
if(m==-1)
{
printf("\n Error Occured : ");
}
n=open("tu.txt",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
if(n==-1)
{
printf("\n Error Occured : ");
}
lseek(m,2,SEEK_SET);
lseek(n,5,SEEK_SET);
while(nread=read(m,buf,sizeof(buf)))
{
write(n,buf,10);
}
return 0;
}
No comments:
Post a Comment