aFile.h¶
- group aFile
Platform Independent File Access Interface.
aFile.h provides a platform independent interface for opening, reading, and writing files.
-
enum aFileMode¶
Enum aFileMode.
Represents whether the file is to be opened in read or write mode.
Values:
-
enumerator aFileModeReadOnly¶
File read mode.
-
enumerator aFileModeWriteOnly¶
File write mode.
-
enumerator aFileModeAppend¶
File write mode from end of current file.
-
enumerator aFileModeUnknown¶
File in unknown mode.
-
enumerator aFileModeReadOnly¶
-
enum aFileSeekMode¶
Enum aFileSeekMode.
Represents the seek start location.
Values:
-
enumerator aSeekStart¶
Perform a seek from the beginning of the file.
-
enumerator aSeekCurrent¶
Perform a seek from the current location.
-
enumerator aSeekEnd¶
Perform a seek from the end of the file.
-
enumerator aSeekStart¶
-
bool aFile_Exists(const char *pFilename)¶
Does the File Exist.
Checks for the existence of a file at filename.
- Parameters:
pFilename – path to file.
- Returns:
bool True if file exists, false otherwise.
-
aFileRef aFile_Open(const char *pFilename, const aFileMode eMode)¶
Open a File.
Opens the file Given in pFilename with the given fileMode eMode.
- Parameters:
pFilename – path to file.
eMode – Open the file for Reading or Writing.
- Returns:
aFileRef on success or NULL on failure.
-
aErr aFile_Close(aFileRef *fileRef)¶
Close an open file.
Close an open file. The fileRef is set to NULL on success.
- Parameters:
fileRef – Pointer to the handle to the open file.
- Return values:
aErrNone – Success.
aErrParam – invalid file reference.
- Returns:
Function returns aErr values.
-
aErr aFile_Read(aFileRef fileRef, uint8_t *pBuffer, const size_t nLength, size_t *pActuallyRead)¶
Read from an open file.
Read from an open file.
- Parameters:
fileRef – The handle to the open file.
pBuffer – The data buffer to read into.
nLength – The length of the read buffer.
pActuallyRead – The Number of bytes actually read from the file.
- Return values:
aErrNone – Success.
aErrMode – The file is not readable.
aErrIO – An error occured reading from the file.
aErrEOF – Read reached the end of the file.
- Returns:
Function returns aErr values.
-
aErr aFile_Write(aFileRef fileRef, const uint8_t *pBuffer, const size_t nLength, size_t *pActuallyWritten)¶
Write to an open file.
Write to an open file.
- Parameters:
fileRef – The handle to the open file.
pBuffer – The data to write.
nLength – The length of the data to write.
pActuallyWritten – The Number of bytes actually written to the file.
- Return values:
aErrNone – Success.
aErrMode – The file is not writable.
aErrIO – An error occured writing to the file.
- Returns:
Function returns aErr values.
-
aErr aFile_Seek(aFileRef fileRef, const long nOffset, aFileSeekMode seekFrom)¶
Seek within an open file.
Seek within an open file.
- Parameters:
fileRef – The handle to the open file.
nOffset – The number of bytes to move within the file.
seekFrom – The location to begin the seek from.
- Return values:
aErrNone – Success.
aErrEOF – Seek would run off the end of the file.
aErrRange – Seek would run off the beginning of the file.
aErrIO – An error occured moving the file pointer.
- Returns:
Function returns aErr values.
-
aErr aFile_GetSize(aFileRef fileRef, size_t *pulSize)¶
Get the size of an open file.
Get the size of an open file.
- Parameters:
fileRef – The handle to the open file.
pulSize – Out param filled with the size of the open file.
- Return values:
aErrNone – Success.
aErrParam – the fileRef is invalid.
aErrIO – an error occured calculating the size.
- Returns:
Function returns aErr values.
-
aErr aFile_Delete(const char *pFilename)¶
Delete a File.
Deletes the given file pFilename.
- Parameters:
pFilename – Path to file.
- Return values:
aErrNone – Success.
aErrPermission – user has insufficient priviledges.
aErrNotFound – if the file cannot be located.
- Returns:
Function returns aErr values.