basic_streambuf::sbumpc
basic_streambuf::sbumpc
To move the get pointer.
int_type sbumpc();
The function
sbumpc() moves the get pointer one element when called.
Return
The value of the character at the
get pointer. It returns
uflow() if it fails to move the pointer.
sgetc()
#include <iostream>
#include <sstream>
const int size = 100;
std::string buf = "CodeWarrior --Software at Work--";
int main()
{
using namespace std;
stringbuf strbuf(buf);
int ch;
for (int i = 0; i < 23; i++)
{
ch = strbuf.sgetc();
strbuf.sbumpc();
cout.put(ch);
}
cout << endl;
cout << strbuf.str() << endl;
return 0;
}
Result:
CodeWarrior
CodeWarrior --Software at Work--