(a) (i) Write statements using seekg( ) to achieve the following : (a…

Previous year question for Object Oriented Programming Using C++.

Question

(a) (i) Write statements using seekg( ) to achieve the following :

(a) To move the pointer by 15 positions backward from current position.

(b) To go to the beginning after an operation is over.

(c) To go backward by 20 bytes from the end.

(d) To go to byte number 50 in the file.

(ii) Describe the various approaches by which we can detect the end-of-file condition successfully.

(b) Write a program that reads a text file and creates another file that is identical except that every sequence of consecutive blank spaces is replaced by a single space.

Related pages

More PYQs on Random Access File Operations

Open on CachedInfo