fstream is a standard C++ library that handles reading from and writing to files either in text or in binary formats. It is an object oriented alternative to C's FILE from the C standard library.
ifstream is the C++ standard library class that provides an interface to read data from files as input streams. The input stream may open a file in the constructor, just like an output stream. ifstream inf("input.dat", ifstream::in); //ifstream::in is a default, so it could be omited
or afterwards:
ifstream inf; inf.open("input.dat");
To close a stream, one uses the close
method: inf.close();
The ifstream destructor will close the file cleanly as well. It is perfectly acceptable to allow the ifstream object to fall out of scope without calling close
. This is often a desirable style, as it simplifies the "clean up" process when an exception is thrown or an error is otherwise encountered.
A C++ PROGRAM TO IMPLEMENT READ & WRITE OPERATIONS IN FILES-COMPLE ARITHMETICS IN DIFFERENT FILES
COMPILER EMPLOYED: DEV C++ COMPILER-4.9.9.2
SOURCE FILE SIZE :3 kb
EXE FILE SIZE :580 kb
NOTE: PLEASE INCLUDE THE DESIRED HEADER FILE
---------------------------------------------------------------------------------------------
C++ PROGRAM SOURCE & EXE DOWNLOAD:
Click download button to download
DISCLAIMER: The following program cannot be ensured of perfection.so any flaws in the program can be notified in the comments section.
Your's friendly,
[MOHANRAM.G],
ADMIN...
0 comments:
Post a Comment