DESCRIPTION:
It is used to get/set fill character. The fill character is the character used by output insertion functions to fill spaces when padding results to the field width.
Declaration:
get (1) char fill() const;
set (2) char fill (char fillch);
Parameters:
fillch - The new fill character.
Return Value:
The value of the fill character before the call.
Program:
#include <iostream>
using namespace std;
int main () {
char prev;
std::cout.width (10);
std::cout << 40 << '\n';
prev = std::cout.fill ('x');
std::cout.width (10);
std::cout << 40 << '\n';
std::cout.fill(prev);
return 0;
}Output:
40
xxxxxxxx40
Name | Views | Likes |
---|---|---|
C++ std::ios_base::pword | 236 | 0 |
C++ std::ios::exceptions | 242 | 0 |
C++ ios | 210 | 0 |
C++ std::stringbuf::seekoff | 219 | 0 |
C++ IOS :: eof() function | 524 | 0 |
C++ ios :: nounitbuf | 185 | 0 |
C++ std::ios_base::register_callback | 202 | 0 |
C++ std::ios_base::iword | 197 | 0 |
C++ ios::nouppercase | 216 | 1 |
C++ ios::internal | 288 | 0 |
C++ ios::hexfloat | 210 | 0 |
C++ ios_base :: oct,dec,hex | 328 | 0 |
C++ ios :: boolalpha | 359 | 0 |
C++ std::ios_base::sync_with_stdio | 217 | 0 |
C++ std::ios_base::fmtflags | 222 | 0 |
C++ std::resetiosflags | 320 | 0 |
C++ ios :: skipws | 275 | 0 |
C++ std::basic_istringstream::rdbuf | 208 | 0 |
C++ fill( ) function | 275 | 0 |
C++ std::stringbuf::pbackfail | 222 | 0 |
C++ std::stringbuf::overflow | 228 | 0 |
C++ std::ios::tie | 375 | 0 |
C++ ios ::io_errc | 195 | 0 |
C++ std::setiosflags | 235 | 0 |
C++ std::ios_base::setf | 215 | 0 |
Comments