Answers

Question and Answer:

  Home  Search Pattern

⟩ Tell me what is the output of this program? #include<stdio.h> #include<fcntl.h> int main() { int fd, count; char ch; fd = open("google.txt",O_RDWR|O_CREAT); write(fd,"s",1); lseek(fd,0,SEEK_SET); write(fd,"d",1); lseek(fd,0,0); read(fd,&ch,1); printf("%cn",ch); return 0; } a) d b) s c) sd d) none of the mentioned

d) none of the mentioned

Explanation:

Because of "lseek" system call the character "s" is overwritten by character "d" in the file "google.txt".

Output:

[root@localhost google]# gcc -o san san.c

[root@localhost google]# ./san

d

[root@localhost google]#

 144 views

More Questions for you: