file pointers & manipulators.pptx

1,255 views 7 slides Feb 15, 2023
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

its useful


Slide Content

FILE POINTERS AND THEIR MANIPULATORS - Megul raj

File Pointers The c++ I/O system supports four functions for setting a file pointer to any desired position inside the file or to get the current file pointer. These allow programmer to have control over a position in the file where the read or write operation takes place.

FUNCTION MEMBER OF CLASS seekg() ifstream tellg() ifstream seekp() ofstream tellp() ofstream There are two pointers in the class fstream – the put pointer used for writing and the get pointer used for reading

seekg() Moves get file pointer(input)to a specified location. Syntax: seekg( offset, refposition); tellg() Gives the current position of the get pointer. Syntax: pos_type tellg ();

seekp() Moves put file pointer(output)to a specified location. Syntax: seekp( offset, refposition); tellp() Gives the current position of the put pointer. Syntax: pos_type tellp ();
Tags