diff options
author | Mike Buland <mike@xagasoft.com> | 2024-07-15 12:59:18 -0700 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2024-07-15 12:59:18 -0700 |
commit | 499cdaf05204a40d86e0e1b4dd32709b3ab67e20 (patch) | |
tree | 5fa31a6e4b4e2c3abde43b4e52ef3a88f6cab864 /src/tests | |
parent | 4bf0f0c256693e30017f9bea60cf55aa97f8994a (diff) | |
download | libbu++-499cdaf05204a40d86e0e1b4dd32709b3ab67e20.tar.gz libbu++-499cdaf05204a40d86e0e1b4dd32709b3ab67e20.tar.bz2 libbu++-499cdaf05204a40d86e0e1b4dd32709b3ab67e20.tar.xz libbu++-499cdaf05204a40d86e0e1b4dd32709b3ab67e20.zip |
MyriadFs improvements and new helper tool.
I think the interface could be a lot better...but it does work and we
can use it examine and work with MyriadFs files.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/myriadfs.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp index cb6c6c3..1266e4b 100644 --- a/src/tests/myriadfs.cpp +++ b/src/tests/myriadfs.cpp | |||
@@ -30,6 +30,14 @@ int main() | |||
30 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); | 30 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); |
31 | ms.write("world, again!"); | 31 | ms.write("world, again!"); |
32 | } | 32 | } |
33 | { | ||
34 | Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Write ); | ||
35 | ms.write("[longer text shouldn't be seen]"); | ||
36 | } | ||
37 | { | ||
38 | Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Write|Bu::MyriadFs::Create|Bu::MyriadFs::Truncate ); | ||
39 | ms.write("[short text]"); | ||
40 | } | ||
33 | 41 | ||
34 | sio << "Reading files..." << sio.nl; | 42 | sio << "Reading files..." << sio.nl; |
35 | { | 43 | { |
@@ -44,5 +52,11 @@ int main() | |||
44 | buf[ms.read( buf, 512 )] = '\0'; | 52 | buf[ms.read( buf, 512 )] = '\0'; |
45 | sio << "read: '" << buf << "'" << sio.nl; | 53 | sio << "read: '" << buf << "'" << sio.nl; |
46 | } | 54 | } |
55 | { | ||
56 | Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Read ); | ||
57 | char buf[512]; | ||
58 | buf[ms.read( buf, 512 )] = '\0'; | ||
59 | sio << "read: '" << buf << "'" << sio.nl; | ||
60 | } | ||
47 | } | 61 | } |
48 | 62 | ||