24#error "File library is NOT supported by SubCore."
47#define FILE_READ O_RDONLY
48#define FILE_WRITE (O_RDONLY | O_WRONLY | O_CREAT)
55class File :
public Stream {
61 unsigned long _curpos;
89 virtual size_t write(uint8_t data);
98 virtual size_t write(
const uint8_t *buf,
size_t size);
135 int read(
void *buf,
size_t nbyte);
The File class allows for reading from and writing to individual files on the File System.
Definition: File.h:55
virtual int available()
Check if there are any bytes available for reading from the file.
void rewindDirectory(void)
Bring you back to the first file in the directory.
File openNextFile(uint8_t mode=O_RDONLY)
Reports the next file or folder in a directory.
File(const char *name, uint8_t mode=FILE_READ)
Construct a new File object.
boolean seek(uint32_t pos)
Seek to a new position in the file.
boolean isDirectory(void)
Check if the current file is a directory or not.
uint32_t size()
Get the size of the file.
char * name()
Returns the file name.
virtual int peek()
Read a byte from the file without advancing to the next one.
void close()
Close the file.
virtual void flush()
Ensures that any bytes written to the file are physically saved to the File System.
int read(void *buf, size_t nbyte)
Read from the file.
uint32_t position()
Get the current position within the file.
virtual int read()
Read from the file.
~File()
Destroy File object.
virtual size_t write(const uint8_t *buf, size_t size)
Write data to the file.
virtual size_t write(uint8_t data)
Write data to the file.
File()
Construct a new File object.
#define FILE_READ
Definition: File.h:47