public member function
std::ios::fill
<ios>
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// 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:
Basic template member declaration
(
basic_ios<charT,traits> )
1 2 3
|
typedef charT char_type;
char_type fill () const;
char_type fill ( char_type fillch );
|
See also
- setfill
- Set fill character (function)
- ios_base::width
- Get/set field width (public member function)