C++ Library - <ios>



Introduction

The C++ standard libraries provide an extensive set of input/output capabilities which we will see in subsequent chapters. This chapter will discuss very basic and most common I/O operations required for C++ programming.

Input-Output base classes and types for the IOStream hierarchy of classes as shown below −

Types

Class templates

Sr.No.Member typesDefinition
1basic_iosBase class for streams (type-dependent components
2fposStream position class template

Classes

Sr.No.Member typesDefinition
1iosBase class for streams (type-dependent components)
2ios_baseBase class for streams
3wiosBase class for wide character streams

Other types

Sr.No.Member typesDefinition
1io_errcInput/output error conditions
2streamoffStream offset type
3streamposStream position type
4streamsizeStream size type
5wstreamposWide stream position type

Format flag manipulators (functions)

Independent flags (switch on) −

Sr.No.Member typesDefinition
1boolalphaAlphanumerical bool values
2showbaseShow numerical base prefixes
3showpointShow decimal point
4showposShow positive signs
5skipwsSkip whitespaces
6unitbufFlush buffer after insertions
7uppercaseGenerate upper-case letters

Independent flags (switch off) −

Sr.No.Member typesDefinition
1noboolalphaNo alphanumerical bool values
2noshowbaseDo not show numerical base prefixes
3noshowpointDo not show decimal point
4noshowposDo not show positive signs
5noskipwsDo not skip whitespaces
6nounitbufDo not force flushes after insertions
7nouppercaseDo not generate upper case letters

Numerical base format flags ("basefield" flags) −

Sr.No.Member typesDefinition
1decUse decimal base
2hexUse hexadecimal base
3octUse octal base

Floating-point format flags ("floatfield" flags) −

Sr.No.Member typesDefinition
1fixedUse fixed floating-point notation
2scientificUse scientific floating-point notation

Adustment format flags ("adjustfield" flags) −

Sr.No.Member typesDefinition
1internalAdjust field by inserting characters at an internal position
2leftAdjust output to the left
3rightAdjust output to the right
Advertisements
close