From 499cdaf05204a40d86e0e1b4dd32709b3ab67e20 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 15 Jul 2024 12:59:18 -0700 Subject: 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. --- src/tests/myriadfs.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tests') 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() Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); ms.write("world, again!"); } + { + Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Write ); + ms.write("[longer text shouldn't be seen]"); + } + { + Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Write|Bu::MyriadFs::Create|Bu::MyriadFs::Truncate ); + ms.write("[short text]"); + } sio << "Reading files..." << sio.nl; { @@ -44,5 +52,11 @@ int main() buf[ms.read( buf, 512 )] = '\0'; sio << "read: '" << buf << "'" << sio.nl; } + { + Bu::MyriadStream ms = mfs.open("/etc/trunc", Bu::MyriadFs::Read ); + char buf[512]; + buf[ms.read( buf, 512 )] = '\0'; + sio << "read: '" << buf << "'" << sio.nl; + } } -- cgit v1.2.3