Message from C, C++ talks

June 2019

β€” This will crash if the file wasn't opened

β€” Yup, thanks for help :)

β€” Why do you use C fopen if you are using C++?

β€” Cause i don't know how to read int from c++ style filesπŸ˜…


Fstream filee("c:\\cfiles\\bankrecord.txt",ios::in|ios::out|ios::app);
cout << "error in opening file\n";
filee << ch << " Record\n";
filee << "Account holder name: " << name <<"\n";
filee << "Account number: " << acno <<"\n";
filee << "Amount: " << amount << "\n";
filee << "End\n";
cout << "File saved succesfully\n";


β€” Yeah but reading from there using streams

β€” Ok will try

β€” πŸ˜

β€” Nah no need :D

β€” I was just thinking why you mix those

β€” Why/

β€” All functions fputc fgetc take pointer to files as argument

β€” Doesn't look clean ;)

β€” Code?

β€” In C++ you could do

int a;
ifstream ifs("file.txt");
ifs >> a;

to read the integer to a