ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code in text files?
#include <stdio.h>
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;
}

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.