Vidyalelo
C++ Programming · Q740

C++ miscellaneous

Programming · C++ Programming · question 740

Q740

What will be the output of the following C++ code in text files? #include int main () char buffer[BUFSIZ]; FILE *p1, *p2; p1 = fopen ("myfile.txt", "w"); p2 = fopen ("myfile2.txt", "a"); setbuf ( p1 , buffer ); fputs ("Buffered stream", p1); fflush (p1); setbuf ( p2 , NULL ); fputs ("Unbuffered stream", p2); fclose (p1); fclose (p2); return 0;

A.
Buffered stream
B.
Unbuffered stream
C.
Error
D.
Buffered & Unbuffered stream
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board