- C++ Library - Home
- C++ Library - <fstream>
- C++ Library - <iomanip>
- C++ Library - <ios>
- C++ Library - <iosfwd>
- C++ Library - <iostream>
- C++ Library - <istream>
- C++ Library - <ostream>
- C++ Library - <sstream>
- C++ Library - <streambuf>
- C++ Library - <atomic>
- C++ Library - <complex>
- C++ Library - <exception>
- C++ Library - <functional>
- C++ Library - <limits>
- C++ Library - <locale>
- C++ Library - <memory>
- C++ Library - <new>
- C++ Library - <numeric>
- C++ Library - <regex>
- C++ Library - <stdexcept>
- C++ Library - <string>
- C++ Library - <thread>
- C++ Library - <tuple>
- C++ Library - <typeinfo>
- C++ Library - <utility>
- C++ Library - <valarray>
- The C++ STL Library
- C++ Library - <array>
- C++ Library - <bitset>
- C++ Library - <deque>
- C++ Library - <forward_list>
- C++ Library - <list>
- C++ Library - <map>
- C++ Library - <multimap>
- C++ Library - <queue>
- C++ Library - <priority_queue>
- C++ Library - <set>
- C++ Library - <multiset >
- C++ Library - <stack>
- C++ Library - <unordered_map>
- C++ Library - <unordered_set>
- C++ Library - <vector>
- C++ Library - <algorithm>
- C++ Library - <iterator>
- The C++ Advanced Library
- C++ Library - <any>
- C++ Library - <barrier>
- C++ Library - <bit>
- C++ Library - <chrono>
- C++ Library - <cinttypes>
- C++ Library - <clocale>
- C++ Library - <condition_variable>
- C++ Library - <coroutine>
- C++ Library - <cstdlib>
- C++ Library - <cstring>
- C++ Library - <cuchar>
- C++ Library - <charconv>
- C++ Library - <cfenv>
- C++ Library - <cmath>
- C++ Library - <ccomplex>
- C++ Library - <expected>
- C++ Library - <format>
- C++ Library - <future>
- C++ Library - <flat_set>
- C++ Library - <flat_map>
- C++ Library - <filesystem>
- C++ Library - <generator>
- C++ Library - <initializer_list>
- C++ Library - <latch>
- C++ Library - <memory_resource>
- C++ Library - <mutex>
- C++ Library - <mdspan>
- C++ Library - <optional>
- C++ Library - <print>
- C++ Library - <ratio>
- C++ Library - <scoped_allocator>
- C++ Library - <semaphore>
- C++ Library - <source_location>
- C++ Library - <span>
- C++ Library - <spanstream>
- C++ Library - <stacktrace>
- C++ Library - <stop_token>
- C++ Library - <syncstream>
- C++ Library - <system_error>
- C++ Library - <string_view>
- C++ Library - <stdatomic>
- C++ Library - <variant>
- C++ STL Library Cheat Sheet
- C++ STL - Cheat Sheet
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
C++ Library - <ios_base>
Introduction
Base class for the entire hierarchy of stream classes in the standard input/output library, describing the most basic part of a stream which is common to all stream objects, independently of their character type.
It has no public constructors, and thus no objects of this class can be declared. Both ios_base and its derived class basic_ios define the components of streams that do not depend on whether the stream is an input or an output stream: ios_base describes the members that are independent of the template parameters (i.e. the character type and traits), while basic_ios describes the members that do depend on them.
More specifically, the ios_base class maintains the following information of a stream −
| field | member functions | description | |
|---|---|---|---|
| Formatting | format flags |
flags setf unsetf |
A set of internal flags that affect how certain input/output operations are interpreted or generated. See member type fmtflags. |
| field width | width | Width of the next formatted element to insert. | |
| display precision | precision | Decimal precision for the next floating-point value inserted. | |
| locale |
getloc imbue |
The locale object used by the function for formatted input/output operations affected by localization properties. | |
| Other | callback stack | register_callback | Stack of pointers to functions that are called when certain events occur. |
| extensible arrays |
iword pword xalloc |
Internal arrays to store objects of type long and void*. |
Definition
Below is definition of ios_base as shown below −
class ios_base;
Member types
| Sr.No. | Member types | Definition |
|---|---|---|
| 1 | event | Type to indicate event type |
| 2 | event_callback | Event callback function type |
| 3 | fmtflags | Type for stream format flags |
| 4 | iostate | Type for stream state flags |
| 5 | openmode | Type for stream opening mode flags |
| 6 | seekdir | Type for stream seeking direction flag |
Public Member Functions
| Sr.No. | Member types | Definition |
|---|---|---|
| 1 | (constructor) | Construct object (public member function ) |
| 2 | (destructor) | Destruct object (public member function ) |
Formatting
| Sr.No. | Member types | Definition |
|---|---|---|
| 1 | flags | It is used to get/set format flags |
| 2 | setf | It is used to set specific format flags |
| 3 | unsetf | It is used to clear specific format flags |
| 4 | precision | It is used to get/Set floating-point decimal precision |
| 5 | width | It is used to get/set field width |
Locales
Internal extensible array
| Sr.No. | Member types | Definition |
|---|---|---|
| 1 | xalloc | It is used to get new index for extensible array [static] |
| 2 | iword | It is used to get integer element of extensible array |
| 3 | pword | It is used to get pointer element of extensible array |
Others
| Sr.No. | Member types | Definition |
|---|---|---|
| 1 | register_callback | Register event callback function |
| 2 | sync_with_stdio | Toggle synchronization with cstdio streams [static] |