Skip to content

OPTIMUS-PRIME2001/C-FileHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++FileHandler cplusplus

Know More About File Handling

📂What is file?

Ans: A file itself is a bunch of bytes stored on some storage device. Most Computer Programs work with files to store information permanently

🌊What is Stream?

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
To access datas of files through C++ we must include header file [!FSTREAM.H]


Functions of Class Fstream

ClassFunctions
filebufIt sets the file buffers to read and write. It contains clse() and open() member functions in it
fstreambaseThis 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.
ifstreamBeing 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.
ofstreamBeing 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
fstreamIt 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.

DATA FILES

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