Create an output stream declare stream to be of class ofstream - File Handling

Q.  To create an output stream, we must declare the stream to be of class ___________ .
- Published on 17 Jul 15

a. ofstream
b. ifstream
c. iostream
d. None of these

ANSWER: ofstream
 

    Discussion

  • Raj   -Posted on 06 Oct 15
    To create an output stream, we must declare the stream to be of class ofstream.
    C++ has two important classes to handle files, ifstream and ofstream. To use these classes you must include the header file fstream. Ifstream class is used for reading file and ofstream class is used for writing to file.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)