Get and Seekg/p functions in c++

in #programming6 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;

}

}

Coin Marketplace

STEEM 0.36
TRX 0.12
JST 0.040
BTC 70446.49
ETH 3571.68
USDT 1.00
SBD 4.73