-
What is the output of this program?
#include <iostream>
int main ()
{
int k;
FILE * ptr;
char buff[10];
ptr = fopen ("Sample.txt", "w+");
for ( k = 'A' ; k <= 'D' ; k++)
fputc ( k, ptr);
rewind (ptr);
fread (buff, 1, 5, ptr);
fclose (ptr);
buff[3] = '\0';
puts (buff);
return 0;
}
-
- ABC
- EFTLM
- ABCDE
- ABCD
- None of these
Correct Option: A
In this program, We are setting the buffer size upto 3 only, So it is printing ABC.