PlatformIntType NATIVE_INT_TYPE
PlatformUIntType NATIVE_UINT_TYPE
C++-compatible configuration header for fprime configuration.
bool isOpen()
check if file descriptor is open or not.
static Status niceCRC32(U32 &crc, const char *fileName)
Calculates CRC32 of file, not burdening FS.
@ DOESNT_EXIST
File doesn't exist (for read)
@ NOT_OPENED
file hasn't been opened yet
@ BAD_SIZE
Invalid size parameter.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
@ FILE_EXISTS
file already exist (for CREATE with O_EXCL enabled)
@ NO_PERMISSION
No permission to read/write file.
@ OP_OK
Operation was successful.
Status write(const void *buffer, NATIVE_INT_TYPE &size, bool waitForDone=true)
write size; will return amount written or errno
const char * getLastErrorString()
get a string of the last error (typically from strerror)
Status seek(NATIVE_INT_TYPE offset, bool absolute=true)
seek to location. If absolute = true, absolute from beginning of file
Status prealloc(NATIVE_INT_TYPE offset, NATIVE_INT_TYPE len)
Status flush()
flush data to disk. No-op on systems that do not support.
@ OPEN_SYNC_DIRECT_WRITE
Open file for writing, bypassing all caching. Requires data alignment.
@ OPEN_APPEND
Open file for appending.
@ OPEN_WRITE
Open file for writing.
@ OPEN_NO_MODE
File mode not yet selected.
@ OPEN_SYNC_WRITE
Open file for writing; writes don't return until data is on disk.
@ OPEN_CREATE
Open file for writing and truncates file if it exists, ie same flags as creat()
@ OPEN_READ
Open file for reading.
NATIVE_INT_TYPE getLastError()
read back last error code (typically errno)
Status open(const char *fileName, Mode mode)
open file. Writing creates file if it doesn't exist
virtual ~File()
Destructor. Will close file if still open.
Status bulkWrite(const void *buffer, NATIVE_UINT_TYPE &totalSize, NATIVE_INT_TYPE chunkSize)
write size; will return amount written or errno
Status read(void *buffer, NATIVE_INT_TYPE &size, bool waitForFull=true)
waitForFull = true to wait for all bytes to be read
Status calculateCRC32(U32 &crc)
calculates the CRC32 of the file