|
uint16_t constexpr | File_StatDateYear (uint16_t date) |
|
uint16_t constexpr | File_StatDateMonth (uint16_t date) |
|
uint16_t constexpr | File_StatDateDay (uint16_t date) |
|
uint16_t constexpr | File_StatTimeHour (uint16_t time) |
|
uint16_t constexpr | File_StatTimeMinute (uint16_t time) |
|
uint16_t constexpr | File_StatTimeSecond (uint16_t time) |
|
int | File_Close (int fd) |
|
int | File_FindClose (int findHandle) |
|
int | File_FindFirst (const wchar_t *path, int *findHandle, wchar_t *name, struct File_FindInfo *findInfoBuf) |
|
int | File_FindNext (int findHandle, wchar_t *name, struct File_FindInfo *findInfoBuf) |
|
int | File_Fstat (int fd, struct File_Stat *buf) |
|
int | File_GetAddr (int fd, int offset, const void **addr) |
|
int | File_Lseek (int fd, int offset, int whence) |
|
int | File_Mkdir (const char *path) |
|
int | File_Open (const char *path, int flags) |
|
int | File_Read (int fd, void *buf, int count) |
|
int | File_Remove (const char *path) |
|
int | File_Rename (const char *oldPath, const char *newPath) |
|
int | File_Stat (const char *path, struct File_Stat *buf) |
|
int | File_Write (int fd, const void *buf, int count) |
|
|
const int | FILE_SEEK_SET = 0 |
| Set the file offset to offset .
|
|
const int | FILE_SEEK_CUR = 1 |
| Set the file offset to the current position, plus offset bytes.
|
|
const int | FILE_SEEK_END = 2 |
| Set the file offset to the end of the file, plus offset bytes.
|
|
const int | FILE_OPEN_READ = 1 << 0 |
| Open the file as readable.
|
|
const int | FILE_OPEN_WRITE = 1 << 1 |
| Open the file as writable.
|
|
const int | FILE_OPEN_CREATE = 1 << 2 |
| Create the file, if it does not already exist.
|
|
const int | FILE_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 | FILE_ENOMEM = -1 |
|
const int | FILE_EINVAL = -2 |
|
const int | FILE_EDEVFAIL = -3 |
|
const int | FILE_EMOUNTED = -4 |
|
const int | FILE_EACCES = -5 |
|
const int | FILE_EBADFSID = -6 |
|
const int | FILE_ENOVOLUME = -7 |
|
const int | FILE_ENOPATH = -8 |
|
const int | FILE_EEXIST = -9 |
|
const int | FILE_ENAMETOOLONG = -10 |
|
const int | FILE_EOUTOFBOUND = -11 |
|
const int | FILE_EUNFORMAT = -12 |
|
const int | FILE_ENOSPC = -13 |
|
const int | FILE_ENOENT = -14 |
|
const int | FILE_EISDIRECTORY = -15 |
|
const int | FILE_ESHARE = -16 |
|
const int | FILE_EMFILE = -17 |
|
const int | FILE_EBADF = -18 |
|
const int | FILE_EEOF = -19 |
|
const int | FILE_ENOTEMPTY = -20 |
|
const int | FILE_ECLUSTERSIZEMISMATCH = -40 |
|
const int | FILE_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];
if (ret < 0) {
goto exit;
}
if (ret < 0) {
}
exit:
int File_Open(const char *path, int flags)
int File_Read(int fd, void *buf, int count)
const int FILE_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};
if (ret < 0) {
goto exit;
}
if (ret < 0) {
}
exit:
int File_Write(int fd, const void *buf, int count)
const int FILE_OPEN_WRITE
Open the file as writable.
Definition file.hpp:113
const int FILE_OPEN_CREATE
Create the file, if it does not already exist.
Definition file.hpp:115
int File_FindFirst |
( |
const wchar_t * |
path, |
|
|
int * |
findHandle, |
|
|
wchar_t * |
name, |
|
|
struct File_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 File_FindNext, passing in the find handle returned by this function. Ensure the find handle is closed using File_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.