In the output of this program, the string “/* Linux */” will be added at the ____ of the source file. [code] #include<stdio.h> #include<st

In the output of this program, the string “/* Linux */” will be added at the ____ of the source file.
Code:
   #include<stdio.h>
   #include<stdlib.h>
   #include<fcntl.h>
   int main()
   {
       int fd;
       fd = open("san.c",O_RDWR|O_APPEND);
       write(fd,"/* Linux */",11);
       return 0;
   }
A. end
B. beginning
C. second line
D. third line
 
Answer: a
Explanation: The write system call writes at the end of the file because the file is opened with O_APPEND flag.
Output:
[root@localhost 123hoidap]# gcc -o san san.c
[root@localhost 123hoidap]# ./san
[root@localhost 123hoidap]# vim san.c
[root@localhost 123hoidap]#
 

Tìm kiếm

Back
Top