function
<ios> <iostream>
std::noshowbase
ios_base& noshowbase (ios_base& str);
Do not show numerical base prefixes
Clears the showbase format flag for the str stream.
When the showbase format flag is not set, numerical values are inserted into the stream without prefixing them with any numerical base prefix (i.e., 0x for hexadecimal values, 0 for octal values and no prefix for decimal-base values).
This flag can be set with the showbase manipulator, which forces the prefixing of numerical integer values with their respective numerical base prefix.
For standard streams, the showbase flag is not set on initialization.
Parameters
- str
- Stream object whose format flag is affected.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<
) and extraction (>>
) operations on streams (see example below).
Return Value
Argument str.
Example
1 2 3 4 5 6 7 8 9
|
// modify showbase flag
#include <iostream> // std::cout, std::showbase, std::noshowbase
int main () {
int n = 20;
std::cout << std::hex << std::showbase << n << '\n';
std::cout << std::hex << std::noshowbase << n << '\n';
return 0;
}
| |
Output:
Data races
Modifies str. Concurrent access to the same stream object may cause data races.
Exception safety
Basic guarantee: if an exception is thrown, str is in a valid state.