Home » C++ Programming » Files and Streams » Question
  1. What is the output of this program?
    #include <iostream>
    int main ()
    {
    FILE * ptr;
    long size;
    ptr = fopen ("Example.txt", "rb");
    if (ptr == NULL)
    perror ("Error opening file");
    else
    {
    fseek (ptr, 0, SEEK_END);
    size = ftell (ptr);
    fclose (ptr);
    printf (" %ld\n", size);
    }
    return 0;
    }
    1. Depends upon the file
    2. 50
    3. 100
    4. 20
    5. None of these
Correct Option: A

This program will return the size of the file in bytes.



Your comments will be displayed only after manual approval.