English

What does the seekg() and seekp() functions do?

Advertisements
Advertisements

Question

What does the seekg() and seekp() functions do?

Short Answer
Advertisements

Solution

seekg() and seekp() are C++ file-stream functions:

  • seekg() moves the get pointer, which controls the position for reading.
  • seekp() moves the put pointer, which controls the position for writing.

In Python, the corresponding operation is performed using file.seek(offset). The current position is obtained using file.tell().

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Data File Handling - EXERCISE [Page 145]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 7 Data File Handling
EXERCISE | Q 8. | Page 145
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×