Program to use file pointers tellg() and seekg()

Home Forums C++ Program to use file pointers tellg() and seekg()

This topic contains 0 replies, has 1 voice, and was last updated by  admin 2 weeks, 3 days ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5253

    admin
    Keymaster

    //Program to use file pointers tellg() and seekg()

    #include<fstream>
    #include<iostream>
    using namespace std;

    int main()
    {
    ifstream fin;
    fin.open(“hello.txt”);
    char ch;
    cout<<“\n\n\n”;
    cout<<fin.tellg(); // 0
    fin.seekg(3); //
    cout<<fin.tellg(); //3
    fin.close();
    return 0;
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.