c++ - Indices for Files -


What is the specific type used to store a pointer in a file? I am currently using long unsigned int , but does this make sense? Instead, should I use std :: size_t , or does it even make sense?

As Mike Samor says, if you work with C ++ io currents Std :: streampos is a standard type for representing a file position. See

Note that std :: size_t can not be correct. For example, on 32-bit systems, std :: size_t would be a 32-bit signed integer, while the system would probably support files greater than 2 ^ 32 bytes = 4 GB.

In the FOIWW, POSIX world, there is a (signed) integer type OF_T that is used to represent file size and offset. With different macros (such as on _FILE_OFFSET_BITS = 64 on Linux) it can redefine off_t to become a 64-bit type.

Comments