-
What is the output of this program in text files?
#include <iostream>
int main ()
{
char buff[BUFSIZ];
FILE *ptr1, *ptr2;
ptr1 = fopen ("FirstFile.txt", "w");
ptr2 = fopen ("SecondFile.txt", "a");
setbuf ( ptr1 , buff );
fputs ("Buffered stream", ptr1);
fflush (ptr1);
setbuf ( ptr2 , NULL );
fputs ("Unbuffered stream", ptr2);
fclose (ptr1);
fclose (ptr2);
return 0;
}
-
- Compilation Error
- Buffered stream
- Unbuffered stream
- Buffered & Unbuffered stream
- None of these
Correct Option: D
In this program, the fopen will create the file and send the text to both of the files.