Streams that will perform both input & output operations - class fstream - File Handling

Q.  Streams that will be performing both input and output operations must be declared as class _________ .
- Published on 17 Jul 15

a. iostream
b. fstream
c. stdstream
d. Stdiostream

ANSWER: fstream
 

    Discussion

  • Nihal   -Posted on 06 Oct 15
    Streams that will be performing both input and output operations must be declared as class fstream. fstream type is capable of both input and output without having to close and reopen the file.
    Example:
    void main()
    {
    fstream file;
    file.open("fileName.txt",iso::in | ios::out)
    //Write code for input or output here
    file.close();
    }

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.)