aboutsummaryrefslogtreecommitdiff
path: root/src/tests/myriadfs.cpp
blob: fd96c02e317c8e9373158b4e0ad1905521a5d4f9 (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
#include "bu/file.h"
#include "bu/membuf.h"
#include "bu/myriadfs.h"
#include "bu/myriadstream.h"
#include "bu/sio.h"

using namespace Bu;

int main( int argc, char *argv[] )
{
	Bu::MemBuf mb;
	Bu::MyriadFs mfs( mb, 512 );

	{
		Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read );
		ms.write("world!");
	}

	{
		Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read );
		char buf[512];
		buf[ms.read( buf, 512 )] = '\0';
		sio << "read: '" << buf << "'" << sio.nl;
	}
}