174k views
2 votes
C++ how do you get the byte number of the files
current read position?

1 Answer

2 votes

Final answer:

To get the byte number of the file's current read position in C++, use the tellg() function from the ifstream class and convert the returned streampos value to a byte number by casting it to the appropriate integer type.

Step-by-step explanation:

To get the byte number of the file's current read position in C++, you can use the tellg() function from the ifstream class. The tellg() function returns a value of type streampos, which represents the current position in the stream.

You can then convert this streampos value to a byte number by casting it to the appropriate integer type.

User Ruud Helderman
by
8.3k points