Get and Seekg/p functions in c++

in programming •  7 years ago 

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;

}

}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!