Namespaces
Variants
Views
Actions

std::streamoff

From cppreference.com
< cpp‎ | io
Revision as of 16:41, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <ios>
</td>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td class="t-dcl-nopad">
typedef /*unspecified*/ streamoff;
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

The type std::streamoff is a signed integral type of sufficient size to represent the maximum possible file size supported by the operating system. Typically, this is a typedef to long long.

It is used to represent offsets from stream positions (values of type std::fpos). A std::streamoff value of -1 is also used to represent error conditions by some of the I/O library functions.

Relationship with std::fpos

  • the difference between two std::fpos objects is a value of type std::streamoff
  • a value of type std::streamoff may be added or subtracted from std::fpos yielding a different std::fpos.
  • a value of type std::fpos is implicitly convertible to std::streamoff (the conversion results in the offset from the beginning of the file.
  • a value of type std::fpos is constructible from a value of type std::streamoff

See also

Template:cpp/io/basic istream/dcl list seekgTemplate:cpp/io/basic ostream/dcl list seekp
represents absolute position in a stream or a file
(class template)