Compartir a través de


ios_base Class

The class describes the storage and member functions common to both input and output streams that do not depend on the template parameters. (The template class basic_ios describes what is common and is dependent on template parameters.)

An object of class ios_base stores formatting information, which consists of:

  • Format flags in an object of type fmtflags.

  • An exception mask in an object of type iostate.

  • A field width in an object of type int*.*

  • A display precision in an object of type int.

  • A locale object in an object of type locale.

  • Two extensible arrays, with elements of type long and void pointer.

An object of class ios_base also stores stream state information, in an object of type iostate, and a callback stack.

Constructors

ios_base

Constructs ios_base objects.

Typedefs

event_callback

Describes a function passed to register_call.

fmtflags

Constants to specify the appearance of output.

iostate

Defines constants describing the state of a stream.

openmode

Describes how to interact with a stream.

seekdir

Specifies starting point for offset operations.

Enums

event

Specifies event types.

Constants

adjustfield

A bitmask defined as internal | left | right.

app

Specifies seeking to the end of a stream before each insertion.

ate

Specifies seeking to the end of a stream when its controlling object is first created.

badbit

Records a loss of integrity of the stream buffer.

basefield

A bitmask defined as dec | hex | oct.

beg

Specifies seeking relative to the beginning of a sequence.

binary

Specifies that a file should be read as a binary stream, rather than as a text stream.

boolalpha

Specifies insertion or extraction of objects of type bool as names (such as true and false) rather than as numeric values.

cur

Specifies seeking relative to the current position within a sequence.

dec

Specifies insertion or extraction of integer values in decimal format.

end

Specifies seeking relative to the end of a sequence.

eofbit

Records end-of-file while extracting from a stream.

failbit

Records a failure to extract a valid field from a stream.

fixed

Specifies insertion of floating-point values in fixed-point format (with no exponent field).

floatfield

A bitmask defined as fixed | scientific

goodbit

All state bits clear.

hex

Specifies insertion or extraction of integer values in hexadecimal format.

in

Specifies extraction from a stream.

internal

Pads to a field width by inserting fill characters at a point internal to a generated numeric field.

left

Specifies left justification.

oct

Specifies insertion or extraction of integer values in octal format.

out

Specifies insertion to a stream.

right

Specifies right justification.

scientific

Specifies insertion of floating-point values in scientific format (with an exponent field).

showbase

Specifies insertion of a prefix that reveals the base of a generated integer field.

showpoint

Specifies unconditional insertion of a decimal point in a generated floating-point field.

showpos

Specifies insertion of a plus sign in a nonnegative generated numeric field.

skipws

Specifies skipping leading white space before certain extractions.

trunc

Specifies deleting contents of an existing file when its controlling object is created.

unitbuf

Causes output to be flushed after each insertion.

uppercase

Specifies insertion of uppercase equivalents of lowercase letters in certain insertions.

Member Functions

failure

The member class serves as the base class for all exceptions thrown by the member function clear in template class basic_ios.

flags

Sets or returns the current flag settings.

getloc

Returns the stored locale object.

imbue

Changes the locale.

Init

Creates the standard iostream objects when constructed.

iword

Assigns a value to be stored as an iword.

precision

Specifies the number of digits to display in a floating-point number.

pword

Assigns a value to be stored as a pword.

register_callback

Specifies a callback function.

setf

Sets the specified flags.

sync_with_stdio

Ensures that iostream and C run-time library operations occur in the order that they appear in source code.

unsetf

Causes the specified flags to be off.

width

Sets the length of the output stream.

xalloc

Specifies that a variable shall be part of the stream.

Operators

operator=

The assignment operator for ios_base objects.

Requirements

Header: <ios>

Namespace: std

See Also

Reference

Thread Safety in the C++ Standard Library

iostream Programming

iostreams Conventions