
Long questions with answers for this topic
File handling is reading/writing data to files for permanent storage.
.
ifstream is used to read data from a file.
ofstream is used to write data to a file.
ios::app opens file in append mode (writes at end).
Example: while (in >> x) { ... }.
File handling provides permanent storage. Data stored in variables is temporary and lost after program ends. Files allow saving records, retrieving later, and sharing data between programs. Hence file handling is essential for real applications.
Sign in to access the all questions and answers
It's free and takes just 5 seconds