Get and Seekg/p functions in c++

Words
37
Reading
1 min
Listen
Play
9y


Program Body

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

int main (){

fstream file("password.txt");

if(!file.is_open()){

    cout<<"failed.. try again later"<<endl;

}else {

cout<<"successfully opened"<<endl;

file.seekp(19);

file <<"yep it is"<<endl;

file.seekg(7);

string get;

getline(file,get);

cout<<get<<endl;

}

}

Get and Seekg/p functions in c++ | Ecency