Linux Search Pattern Question: Download Questions PDF
In the output of this program, the string "/* Linux */" will be added at the ____ of the source file.
#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
![Search Pattern Interview Answer Search Pattern Interview Question](https://globalguideline.com/public/images/interview/15.png)
Answer:
a) end
Explanation:
The write system call writes at the end of the file because the file is opened with O_APPEND flag.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
[root@localhost google]# vim san.c
[root@localhost google]#
Explanation:
The write system call writes at the end of the file because the file is opened with O_APPEND flag.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
[root@localhost google]# vim san.c
[root@localhost google]#
Download Search Pattern Interview Questions And Answers
PDF