LIVE Course for free

Rated by 1 million+ students
Get app now
0 votes
3.5k views
in Computer by (25.7k points)

What is the significance of fstream.h header file?

1 Answer

+1 vote
by (26.4k points)
selected by
 
Best answer

The fstream.h header predefines a set or operations for handling files related to input and output. It defines certain classes that help to perform file input and output. For example, ifstream class links a file to the program for input and ofstream class links a file to the program for output and fstream classifies a file to the program for both input and output.

The file operations make use of streams as an interface between the programs and the files, A stream is a sequence of bytes and general name given to flow of data. Input stream and output stream represent different kind of data flow into the memory or out of the memory. The C++ provides ofstream class to write on files, ifstream class to read from files and fstream class to both read and write from/to file.

These classes are derived from fstreambase and from those declared in the header file ” iostream.h”. The classes ofstream, ifstream, and fstream are designed exclusively to manage the disk files and their declaration are present in the header file “fstream.h”. To make use of these classes, fstream.h is included in all the programs which handle disk files.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...