c++ - Is std::streampos guaranteed to be unsigned long long? -
is std::streampos guaranteed unsigned long long?
if not so, how std::istream::seekg work correctly on files larger 4g?
from http://en.cppreference.com/w/cpp/io/fpos:
std::streampos specialization of class template
template< class state > class fpos; std::streampos typedef'ed std::fpos<std::char_traits<char>::state_type>
each object of type fpos holds byte position in stream (typically private fellow member of type std::streamoff).
from http://en.cppreference.com/w/cpp/io/streamoff:
the type std::streamoff signed integral type of sufficient size represent maximum possible file size supported operating system. typically, typedef long long.
to reply questions...
question std::streampos guaranteed unsigned long long?
answer sure meant find out whether underlying integral type holds position guaranteed unsigned long long. in sense, real question whether std::streamoff gueranteed unsigned long long. reply question "no", can infer descriptions above.
question if not so, how std::istream::seekg work correctly on files larger 4g?
answer if operating scheme supports working files larger 4g, it's std::streamoff typdef'ed accordingly. then, going signed integral type. here's quote http://en.cppreference.com/w/cpp/io/streamoff.
a std::streamoff value of -1 used represent error conditions of i/o library functions.
c++ file types integer unsigned-long-long-int
No comments:
Post a Comment