Name

fpos class template — Represents a file position

Synopsis

template <typename stateT>
class fpos{
public:
  stateT state(  ) const;
  void state(stateT);
   
  // The following functionality is required, although not necessarily as member
  // functions.
  fpos(int i);
  fpos(streamoff offset);
  operator streamoff(  ) const;
  bool operator==(const fpos& rhs) const;
  bool operator!=(const fpos& rhs) const;
  fpos operator+(streamoff offset) const;
  fpos operator-(streamoff offset) const;
  fpos& operator+=(streamoff offset);
  fpos& operator-=(streamoff offset);
  streamoff operator-(const fpos& rhs) const;
};

The fpos class template represents a position in a stream. The stateT template parameter is a multibyte shift state, such as mbstate_t. Objects of type fpos can be compared for equality or inequality, they can be subtracted to yield a stream offset, or a stream offset can be added to an fpos position to produce a new fpos. Also, stream offsets can be converted to and from fpos values. Although the declaration in this section shows these functions as member functions, they might be global functions or be provided in some other fashion.

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.