aboutsummaryrefslogtreecommitdiff
path: root/src/tests/dump.cpp
blob: e0dcb52d6d0ef075c4464a747f9d6f420c46ade1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <bu/sio.h>
#include <bu/file.h>
#include <gats/gatsstream.h>
#include <gats/types.h>

using namespace Bu;

int main( int argc, char *argv[] )
{
	File fIn( argv[1], File::Read );
	Gats::GatsStream gsIn( fIn );

	for(;;)
	{
		sio << "Reading from file position: " << fIn.tell() << sio.nl;
		Gats::Object *pObj = gsIn.readObject();
		if( !pObj )
		{
			if( gsIn.hasReadBuffer() )
			{
				sio << "Premature end of stream detected, have "
					<< gsIn.getReadBufferSize() << "b." << sio.nl;
			}
			return 0;
		}

		sio << *pObj << sio.nl;
	}
}