Understanding filestream classes for file operations. Creating and opening file to read content from file and write content to the file. C++ program for file handling of text file or binary file with various file opening modes.
fstreambase: Provides operations common to the file streams. Contains open() and close() functions.
Ifstream: Provides input operations. Contains open() with default input mode. Inherits get(), getline(), read(), seekg() and tellg() functions from istream.
ofstream: Provides output operations. Contains open() with default output mode. Inherits put(), seekp(), tellp() and write() functions from ostream.
fstream: Provides support for simultaneous input and output operations. Inherits all the functions from istream and ostream from iostream.
filebuf: Its purpose is to set the file buffers to read and write.
ios :: in: Open file for reading only. ios :: out: Open file for writing only.
ios :: app: Append to end-of-file. ios :: ate: Go to end-of-file on opening.
ios :: binary: Binary file. ios :: trunc: Delete content of file if exists.
ios :: nocreate: Open fails if the file does not exist. ios :: noreplace: Open fails if the file already exists.
Each file has two associated pointers known as the file pointers.
One of them is called input pointer (or get pointer) and the other is called output pointer (or put pointer).
Input pointer is used for reading the content of a given file location.
Output pointer is used for writing to a given file location.
GTU - Computer Engineering (CE) - Semester 4 - 2140703 - Object Oriented Programming with C++ - Concepts of C++ - Introduction to Object Oriented Programming
Object-Oriented Programming with C++ PPTs are available here: http://www.darshan.ac.in/DIET/CE/GTU-Computer-Engineering-Study-Material
This video is recorded by Prof. Rupesh Vaishnav (email@example.com, +91-9428037452) at Computer Engineering Department of Darshan Institute of Engineering & Technology, Rajkot as per GTU Syllabus.
Darshan Institute of Engineering & Technology, Rajkot is a leading institute offering undergraduate, graduate and postgraduate programs in engineering. The Institute is affiliated to the Gujarat Technological University (GTU) and approved by the AICTE, New Delhi.
Visit us: http://www.darshan.ac.in
Write us: firstname.lastname@example.org