this code gives an "illegal seek error" on close() call
what is this error and when does it come?
main()
{
int fd,num;
char buf[150];
fd = open ("123.c",O_RDWR );
if(fd!=-1)
{
printf("a file with fd=%d is opened\n",fd);
num=read(fd,buf ,150);
printf("num=%d\ nREAD:%s",num,b uf);
perror("READ");
close(fd);
perror("CLOSE") ;
}
}
what is this error and when does it come?
main()
{
int fd,num;
char buf[150];
fd = open ("123.c",O_RDWR );
if(fd!=-1)
{
printf("a file with fd=%d is opened\n",fd);
num=read(fd,buf ,150);
printf("num=%d\ nREAD:%s",num,b uf);
perror("READ");
close(fd);
perror("CLOSE") ;
}
}
Comment