DS Lab Viva
DS Lab Viva
ofstream: It represents output Stream and this is used for writing in files.
ifstream: It represents input Stream and this is used for reading from files.
fstream: It represents both output Stream and input Stream. So it can read from files and
write to files.
Syntax:
file-stream-class stream-object;
stream-object.open("filename",mode);
Where filename is a string representing the name of the file to be opened, and mode is an
optional parameter which represents the different types of file operations such as read, write,
append, truncate etc.