Wraps a SC::FileDescriptor to open it and use strings / buffers. More...
#include <File.h>
Public Member Functions | |
File (FileDescriptor &descriptor) | |
Result | open (StringView path, FileOpen mode) |
Opens file at path with a given mode | |
Result | readUntilEOF (Buffer &destination) |
Reads into a given dynamic buffer until End of File (EOF) is signaled. | |
Result | readUntilEOF (String &destination) |
Reads into a given string until End of File (EOF) is signaled It works also for non-seekable file descriptors (stdout / in / err). | |
Public Attributes | |
FileDescriptor & | fd |
Wraps a SC::FileDescriptor to open it and use strings / buffers.
Example usage:
|
nodiscard |
Opens file at path
with a given mode
path | The path to file |
mode | The mode used to open file (read-only, write-append etc.) |
Reads into a given dynamic buffer until End of File (EOF) is signaled.
It works also for non-seekable file descriptors (stdout / in / err).
destination | A destination buffer to write to (it will be resized as needed) |
Reads into a given string until End of File (EOF) is signaled It works also for non-seekable file descriptors (stdout / in / err).
destination | A destination string to write to (it will be sized as needed) |