Home » C++ Programming » Basic Input/Output » Question
  1. What is the output of this program in the “Example.txt” file?
    #include <fstream>
    using namespace std;
    int main ()
    {
    long pos;
    ofstream outfile;
    outfile.open ("Example.txt");
    outfile.write ("This is a Sample",16);
    pos = outfile.tellp();
    outfile.seekp (pos - 7);
    outfile.write (" Ex", 6);
    outfile.close();
    return 0;
    }
    1. This is a Sample
    2. Ex
    3. Example.txt
    4. This is a Example
    5. None of these
Correct Option: D

In this program, We are changing the ap to sam by using the pos function.



Your comments will be displayed only after manual approval.