#include <fstream>
#include <testsuite_hooks.h>
const char name[] = "tmp_12232";
void test01()
{
using namespace std;
bool test __attribute__((unused)) = true;
filebuf fbout;
fbout.open(name, ios_base::out);
fbout.sputn("abc", 3);
streampos p1 = fbout.pubseekoff(0, ios_base::cur, ios_base::in);
VERIFY( p1 != streampos(-1) );
fbout.sputn("de", 2);
streampos p2 = fbout.pubseekpos(p1, ios_base::openmode());
VERIFY( p2 != streampos(-1) );
fbout.sputn("34", 2);
streampos p3 = fbout.pubseekoff(0, ios_base::beg, ios_base::ate);
VERIFY( p3 != streampos(-1) );
fbout.sputn("012", 3);
fbout.close();
filebuf fbin;
fbin.open(name, ios_base::in);
streampos p4 = fbin.pubseekoff(0, ios_base::beg, ios_base::ate);
VERIFY( p4 != streampos(-1) );
VERIFY( fbin.sgetc() == '0' );
streampos p5 = fbin.pubseekoff(-1, ios_base::end, ios_base::out);
VERIFY( p5 != streampos(-1) );
VERIFY( fbin.sbumpc() == '4' );
streampos p6 = fbin.pubseekpos(p4, ios_base::binary);
VERIFY( p6 != streampos(-1) );
VERIFY( fbin.sbumpc() == '0' );
fbin.close();
}
int main()
{
void test01();
return 0;
}