Know More About File Handling
Ans: A file itself is a bunch of bytes stored on some storage device. Most Computer Programs work with files to store information permanently Ans: A Stream is a Sequence of bytes (binary datas) flowing in the lowest level
- The Stream that supplies data to the program from the file is known as Input Stream
- The Stream that receives data from the program is known as Output Stream
Class | Functions |
---|---|
filebuf | It sets the file buffers to read and write. It contains clse() and open() member functions in it |
fstreambase | This is the base class for fstream, ifstream and ofstream classes. Therefore, it provides operations common to these file streams.It also contains open() and close() functions. |
ifstream | Being an input file stream class, it provides input operations for file. It inherits the functions get(), getline(), read() and functions supporting random access (seekg() and tellg()) from istream class defined inside iostream.h file. |
ofstream | Being an output file stream class, it provides output operations. It inherits put() and write() functions along with functions supporting random access (seekp()and tellp()) from ostream class defined inside iostream.h file |
fstream | It is an input-output file stream class. It provides suppoert for simultaneous input and output operations. It inherits all the functions from istream and ostream classes through iostream class defined inside iostream.h file. |
The data files are the files that stoores data pertaining to a specific application, for later use.The data files can be stored in two ways:
- TEXT FILESStores information in ASCII characters.In text files, each line of text is terminated,(delimited) with special characters known as EOL(End of line) characters.In text files some internal translations take place when this EOL character is read or written
- Binary file