0

Question on Files and Pointers. Put and Get pointers.

ofstream outfile; outfile.open("result.txt", ios::app); int p=outfile.tellp(); cout<<p<<endl; outfile.close(); I have a "result" file in the folder, where there is so much content, yet the program doesn't seem to return the number of bytes associated in the file. WHY?

18th Jun 2020, 1:43 PM
Prashant Pant
Prashant Pant - avatar
2 Réponses
0
use seekg with parameter end to set cursor pointer to end of the file, and then call function tellg
21st Jun 2020, 10:42 AM
george
george - avatar
0
outfile.seekg(0, ios::end); int fz = outfile.tellg(); cout<< fz;
21st Jun 2020, 10:47 AM
george
george - avatar