diff options
| author | Marcel Braun <marcel.braun@ost.ch> | 2026-04-06 11:41:23 +0200 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-04-11 07:58:20 +0200 |
| commit | bf90441a49d9fa2ab3a1c315679f97289cb33dbe (patch) | |
| tree | 808b57534df72e64375073c19d3816299cee8a7a /kernel/src | |
| parent | 4a2d4fb3ab38a64c4b10832f5a6318b7240829cc (diff) | |
| download | teachos-bf90441a49d9fa2ab3a1c315679f97289cb33dbe.tar.xz teachos-bf90441a49d9fa2ab3a1c315679f97289cb33dbe.zip | |
Add test for reading file
Diffstat (limited to 'kernel/src')
| -rw-r--r-- | kernel/src/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index 258c28b..186d32e 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -23,6 +23,7 @@ #include <algorithm> #include <cstddef> +#include <string_view> using namespace kstd::units_literals; @@ -119,6 +120,14 @@ auto test_file_lookup() -> void auto ofd_hello = vfs.open("/hello.txt"); + kstd::vector<std::byte> buffer(64); + auto number_of_read_bytes = ofd_hello->read(buffer.data(), buffer.size()); + kstd::println("read bytes: {}", number_of_read_bytes); + kstd::println("buffer: {::#04x}", buffer); + + std::string_view hello_str{reinterpret_cast<char *>(buffer.data()), number_of_read_bytes}; + kstd::println("hello_str: {}", hello_str); + auto ofd1 = vfs.open("/a/b/c"); auto ofd2 = vfs.open("/dev/ram0"); auto ofd3 = vfs.open("/a/d/e"); |
