Computer Science, asked by snehasidharth2267, 9 months ago

Write a program to read every even character from a random access file using seekg()

method & write all those characters on to a different file. In c++.

Answers

Answered by harwinderb678
0

Answer:

Set position with seekg() in C++ language file handling

seekg() is a function in the iostream library (part of the standard library) that allows you to seek to an arbitrary position in a file. It is used in file handling to sets the position of the next character to be extracted from the input stream from a given file. For example :

Input : "Hello World" Output : World

Syntax – There are two syntax for seekg() in file handling :

istream&seekg(streampos position);

istream&seekg(streamoff offset, ios_base::seekdir dir);

Description –

position : is the new position in the stream buffer.

offset : is an integer value of type streamoff representing the offset in the stream’s buffer. It is relative to the dir parameter.

dir : is the seeking direction. It is an object of type ios_base::seekdir that can take any of the following constant values.

Similar questions