What functions are used instead of the gtgt and ltlt


1.       What header file may be used when reading input from a file and writing output to a file?

2.       How do you test for the end of an input file?

3.       Can fstream be used for both input and output?

4.       Explain each of the following flags:

a.       ios::app

b.      ios::ate

c.       ios::binary

d.      ios::in

e.      ios::out

f.        ios::trunc

5.       Declare an fstream object called infile, which opens the file input.txt for input.

6.       What is the difference between ifstreamand ofstream objects?

7.       What does the fail member function do?

8.       When a file stream object is passed to a function, should it be pass by reference?

9.       Explain the following bits used for error testing:

a.       ios::eofbit

b.      ios::failbit

c.       ios::hardfail

d.      ios::badbit

e.      ios::goodbit

10.   Explain the following member functions:

a.       eof()

b.      fail()

c.       bad()

d.      good()

e.      clear()

11.   What input function is used to read input including whitespace? Explain its format.

12.   What input function is used to read a single character?

13.   What output function is used to write a single character?

14.   Can you have more than one file open at a time?

15.   Give an example of opening an input file in binary mode.

16.   What functions are used instead of the >> and << operators when a file is in binary mode? What type of data do they expect?

17.   Give an example of using the read and write functions.

18.   How can the read and write functions be used on non-character data?

19.   For random access files, what is seekgand seekp?

20.   What arguments are required for seekg and seekp?

21.   Explain the following uses of seekg and seekp:

a.       infile.seekg(31L, ios::beg);

b.      outfile.seekp(-15L, ios::cur);

22.   Explain tellg and tellp. Give an example of using each.

23.   Can a file be opened for both input and output?

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: What functions are used instead of the gtgt and ltlt
Reference No:- TGS0645891

Expected delivery within 24 Hours