|
constexpr uint16_t | statDateYear (uint16_t date) |
|
constexpr uint16_t | statDateMonth (uint16_t date) |
|
constexpr uint16_t | statDateDay (uint16_t date) |
|
constexpr uint16_t | statTimeHour (uint16_t time) |
|
constexpr uint16_t | statTimeMinute (uint16_t time) |
|
constexpr uint16_t | statTimeSecond (uint16_t time) |
|
int | close (int fd) |
|
int | findClose (int findHandle) |
|
int | findFirst (const wchar_t *path, int *findHandle, wchar_t *name, struct findInfo *findInfoBuf) |
|
int | findNext (int findHandle, wchar_t *name, struct findInfo *findInfoBuf) |
|
int | fstat (int fd, struct stat *buf) |
|
int | getAddr (int fd, int offset, const void **addr) |
|
int | lseek (int fd, int offset, int whence) |
|
int | mkdir (const char *path) |
|
int | open (const char *path, int flags) |
|
int | read (int fd, void *buf, int count) |
|
int | remove (const char *path) |
|
int | rename (const char *oldPath, const char *newPath) |
|
int | stat (const char *path, struct stat *buf) |
|
int | write (int fd, const void *buf, int count) |
|
|
const int | SEEK_SET = 0 |
| Set the file offset to offset .
|
|
const int | SEEK_CUR = 1 |
| Set the file offset to the current position, plus offset bytes.
|
|
const int | SEEK_END = 2 |
| Set the file offset to the end of the file, plus offset bytes.
|
|
const int | OPEN_READ = 1 << 0 |
| Open the file as readable.
|
|
const int | OPEN_WRITE = 1 << 1 |
| Open the file as writable.
|
|
const int | OPEN_CREATE = 1 << 2 |
| Create the file, if it does not already exist.
|
|
const int | OPEN_APPEND = 1 << 4 |
| Opens the file with the file offset set to the end of the file.
|
|
|
Errors returned by file system functions. All negative numbers.
|
const int | ENOMEM = -1 |
|
const int | EINVAL = -2 |
|
const int | EDEVFAIL = -3 |
|
const int | EMOUNTED = -4 |
|
const int | EACCES = -5 |
|
const int | EBADFSID = -6 |
|
const int | ENOVOLUME = -7 |
|
const int | ENOPATH = -8 |
|
const int | EEXIST = -9 |
|
const int | ENAMETOOLONG = -10 |
|
const int | EOUTOFBOUND = -11 |
|
const int | EUNFORMAT = -12 |
|
const int | ENOSPC = -13 |
|
const int | ENOENT = -14 |
|
const int | EISDIRECTORY = -15 |
|
const int | ESHARE = -16 |
|
const int | EMFILE = -17 |
|
const int | EBADF = -18 |
|
const int | EEOF = -19 |
|
const int | ENOTEMPTY = -20 |
|
const int | ECLUSTERSIZEMISMATCH = -40 |
|
const int | ESYSTEM = -99 |
|
Functions for interacting with the calculator's file system.
Provides an API similar to that of Unix.
The storage which appears when the calculator is attached to a PC is found under the path \\fls0\
(remember to escape the \
in strings!).
Example: reading 256 bytes from a file called test.txt
from the USB flash
if (fd < 0) {
goto exit;
}
uint8_t buf[256];
int ret =
read(fd, buf,
sizeof(buf));
if (ret < 0) {
goto exit;
}
if (ret < 0) {
}
exit:
int open(const char *path, int flags)
int read(int fd, void *buf, int count)
const int OPEN_READ
Open the file as readable.
Definition: file.hpp:111
Example: writing 16 bytes to a non-existant file called f.bin
in a folder test
in the USB flash
if (fd < 0) {
goto exit;
}
uint8_t buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
int ret =
write(fd, buf,
sizeof(buf));
if (ret < 0) {
goto exit;
}
if (ret < 0) {
}
exit:
int write(int fd, const void *buf, int count)
const int OPEN_CREATE
Create the file, if it does not already exist.
Definition: file.hpp:115
const int OPEN_WRITE
Open the file as writable.
Definition: file.hpp:113
int findFirst |
( |
const wchar_t * |
path, |
|
|
int * |
findHandle, |
|
|
wchar_t * |
name, |
|
|
struct findInfo * |
findInfoBuf |
|
) |
| |
Starts a find operation, locating files matching a specific path.
Can be used to list the contents of a directory by using a wildcard. For example, passing the path L"\\fls0\\*"
or L"\\fls0\\*.*"
matches all files and directories on the calculator's flash (not recursive, though).
To find the next file/directory which matches the path, call findNext, passing in the find handle returned by this function. Ensure the find handle is closed using findClose when the find operation is finished. Bad things happen if the handle is not closed.
- Parameters
-
[in] | path | The path to search. May contain wildcards. |
[out] | findHandle | The find handle created. Must be closed when the find operation is finished. |
[out] | name | The name of the file/directory found. |
[out] | findInfoBuf | Information about the found file. |
- Returns
- 0 on success, or a negative error code on failure.