ios::fill | public member function |
char fill ( ) const; char fill ( char fillch ); |
Get/set the fill character
The first function version returns the fill character.
The second function version sets fillch as the new fill character and returns the fill character previously set.
The fill character is the character used by output insertion functions to fill spaces when padding results to the field width.
The parameterized manipulator setfill can also be used to set the fill character.
Parameters
- fillch
- the new character to be used as fill character.
Return Value
The value of the fill character before the call.Example
// using the fill character #include <iostream> using namespace std; int main () { char prev; cout.width (10); cout << 40 << endl; prev = cout.fill ('x'); cout.width (10); cout << 40 << endl; cout.fill(prev); return 0; } |
The output of this example is something similar to:
40 |
Basic template member declaration
( basic_ios<charT,traits> )typedef charT char_type; char_type fill () const; char_type fill ( char_type fillch ); |
See also
setfill | Set fill character (manipulator function) |
ios_base::width | Get/set field width (public member function) |