ios_base::iword

Assigns a value to be stored as an iword.

long& iword(
   int idx
);

Parameters

  • idx
    The index of the value to store as an iword.

Remarks

The member function returns a reference to element idx of the extensible array with elements of type long. All elements are effectively present and initially store the value zero. The returned reference is invalid after the next call to iword for the object, after the object is altered by a call to basic_ios::copyfmt, or after the object is destroyed.

If idx is negative or if unique storage is unavailable for the element, the function calls setstate(badbit) and returns a reference that might not be unique.

To obtain a unique index, for use across all objects of type ios_base, call xalloc.

Example

See xalloc for a sample of how to use iword.

Requirements

Header: <ios>

Namespace: std

See Also

Reference

ios_base Class

iostream Programming

iostreams Conventions

Other Resources

ios_base Members