Class for writing to a file as a Print.
More...
#include <FileHelperRK.h>
|
int | open (const char *path) |
| Open a file for writing. Opens as O_RDWR | O_CREAT | O_TRUNC.
|
|
virtual size_t | write (uint8_t c) |
| Writes a character to the file Override for Print pure virtual function.
|
|
virtual size_t | write (const uint8_t *buffer, size_t size) |
| Writes multiple bytes to the file Override for Print pure virtual function.
|
|
| FileStreamBase () |
| Construct object; you will typically do this and then call openForReading or openForWriting.
|
|
| FileStreamBase (int fd) |
| Construct object from an existing file descriptor from open()
|
|
virtual | ~FileStreamBase () |
| Destructor.
|
|
int | open (const char *path, int mode, int perm=0666) |
| Open a file.
|
|
int | close () |
| Close the underling file if it was opened using open()
|
|
|
int | fd = -1 |
| File descriptor from open()
|
|
bool | closeFile = false |
| Close file on destructor.
|
|
Class for writing to a file as a Print.
Used for writing a Variant to a file as CBOR.
◆ open()
int FileHelperRK::FileStreamWrite::open |
( |
const char * | path | ) |
|
Open a file for writing. Opens as O_RDWR | O_CREAT | O_TRUNC.
- Parameters
-
path | Filename to write to. File will be created and truncated. |
- Returns
- int SYSTEM_ERROR_NONE (0) on success or a system error code (non-zero)
If you want to use a different mode, call the open() method in the base class.
◆ write() [1/2]
size_t FileHelperRK::FileStreamWrite::write |
( |
const uint8_t * | buffer, |
|
|
size_t | size ) |
|
virtual |
Writes multiple bytes to the file Override for Print pure virtual function.
- Parameters
-
buffer | Pointer to a buffer of bytes to write |
size | Number of bytes to write. |
- Returns
- size_t Number of bytes written (normally size).
◆ write() [2/2]
size_t FileHelperRK::FileStreamWrite::write |
( |
uint8_t | c | ) |
|
|
virtual |
Writes a character to the file Override for Print pure virtual function.
- Parameters
-
c | Byte to write. Can be binary data. |
- Returns
- size_t Number of bytes written (normally 1). 0 on error.
The documentation for this class was generated from the following files: