Question: Will the following code print anything? #include #include #include #include int main ( void ) { int fd [ 2 ] ; char buf 1

Will the following code print anything?
#include
#include
#include
#include
int main(void)
{
int fd[2];
char buf1[12]= "hello world";
char buf2[12];
fd[0]= open("sample.txt", O_RDWR);
fd[1]= open("sample.txt", O_RDWR);
write(fd[0], buf1, strlen(buf1));
write(1, buf2, read(fd[1], buf2,12));
close(fd[0]);
close(fd[1]);
return 0;
}
It will not print anything.
The code will introduce an error.
It will print hello world to the stdout.
print hello
3
8 times
5 times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!