[Solved] Which of these if the correct way to use seekg? [closed]


seekg(a, b) will set the read position to b offset by a bytes.

Thus:

  • A.seekg(0, ios::beg) is equivalent to A.seekg(0).
  • A.seekg(0, ios::end) is equivalent to A.seekg(10) if the file is 10 bytes.
  • A.seekg(10, ios::end) is equivalent to A.seekg(20). That won’t work with a 10-byte file.

The documentation on seekg would have answered your question.

2

solved Which of these if the correct way to use seekg? [closed]