What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
#include<errno.h>
#include<sys/stat.h>
#include<sys/mman.h>
int main()
{
int s_id;
s_id = shm_open("shared_memory",O_TRUNC,0666);
if(s_id == -1)
perror("shm_open\n");
return 0;
}
#include<stdio.h>
#include<fcntl.h>
#include<errno.h>
#include<sys/stat.h>
#include<sys/mman.h>
int main()
{
int s_id;
s_id = shm_open("shared_memory",O_TRUNC,0666);
if(s_id == -1)
perror("shm_open\n");
return 0;
}
A. this program will give an error because OTRUNC is not a valid flag
B. this program will give an error
C. this program will give segmentation fault
D. none of the mentioned
Answer: Option B
Related Questions on Linux
What command is used to count the total number of lines, words, and characters contained in a file?
A. countw
B. wcount
C. wc
D. count p
E. None of the above
What command is used with vi editor to delete a single character?
A. x
B. y
C. a
D. z
E. None of the above
Join The Discussion