C++ file open program

in #programming7 years ago (edited)

Program body

#include iostream
#include string
#include fstream
using namespace std;

int main (){
fstream file;
file.open("sabi.txt",ios:: in |ios :: out | ios :: trunc);
if(file.is_open()){
cout<<"File opened successfully"<<endl;
}else {
cout<<"an error while opening file"<<endl;
}
file.close();
}

Working of program

this is what is shown when you have any file you specified before like here (sabi.txt)
ssass.JPG

I hope you enjoyed it

sorry The v shaped things around iostream etc can't be placed here as they are html componenets too

Sort:  

good one, did you miss adding library names with include statements ?

sorry I did I guess.. haha

More of this would be highly appreciated

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62978.31
ETH 2546.24
USDT 1.00
SBD 2.76