Emperor Sabi avatar

C++ file open program

learnandgrow

Published: 15 Jan 2018 › Updated: 15 Jan 2018C++ file open program

C++ file open program

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

Leave C++ file open program to:

Written by

SCIENTIST, Programmer,Photographer, Entrepreneur & Steemian .

Read more #programming posts


Best Posts From Emperor Sabi

We have not curated any of learnandgrow's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Emperor Sabi