Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
27.filebuf.close.stdcxx-969.cpp
Go to the documentation of this file.
1
29#include <cassert>
30#include <fstream>
31
32int main ()
33{
34 struct Filebuf : std::filebuf
35 {
36 char* pubgptr () const {
37 return gptr ();
38 }
39
40 char* pubpptr () const {
41 return pptr ();
42 }
43 };
44
45 Filebuf fb;
46 fb.open (__FILE__, std::ios::in);
47
48 fb.sgetc ();
49 fb.close ();
50
51 // verify that get area is not active after close()
52 assert (0 == fb.pubgptr ());
53 // verify that put area is not active after close()
54 assert (0 == fb.pubpptr ());
55
56 // verify that calling pubsync() after close()
57 // doesn't abort the program on MSVC 8.0 and later
58 fb.pubsync ();
59
60 return 0;
61}
#define assert(expr)
Definition _cassert.h:40