33 pInputFile = fopen(filePath,
"rb");
43 pHandle->
handle = pInputFile;
89 pInputFile = fopen(filePath,
"wb");
99 pHandle->
handle = pInputFile;
133 pInputFile = (FILE*)(pHandle->
handle);
171 pInputFile = (FILE*)(pHandle->
handle);
181 cursorPos = ftell(pInputFile);
182 fseek(pInputFile, 0, SEEK_END);
183 fileSize = ftell(pInputFile);
184 fseek(pInputFile, cursorPos, SEEK_SET);
187 return (
size_t)fileSize;
207 pInputFile = (FILE*)(pHandle->
handle);
217 return (
size_t)ftell(pInputFile);
249 pOutputFile = (FILE*)(pHandle->
handle);
254 bytesWritten = fwrite(pBuffer,
sizeof(uint8_t), bytesToWrite, pOutputFile);
259 if (bytesWritten == bytesToWrite)
292 pInputFile = (FILE*)(pHandle->
handle);
297 *pReadBytes = fread(pBuffer,
sizeof(uint8_t), bytesToRead, pInputFile);
321 pInputFile = (FILE*)(pHandle->
handle);
326 ret = fflush(pInputFile);
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileWriteFake(SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
#define SBG_COMMON_LIB_API
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileReadFake(SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileWriteOpen(SbgInterface *pHandle, const char *filePath)
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileFlush(SbgInterface *pHandle)
void sbgInterfaceZeroInit(SbgInterface *pHandle)
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileClose(SbgInterface *pHandle)
SbgInterfaceHandle handle
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileOpen(SbgInterface *pHandle, const char *filePath)
SBG_COMMON_LIB_API size_t sbgInterfaceFileGetSize(SbgInterface *pHandle)
SbgInterfaceReadFunc pReadFunc
void sbgInterfaceNameSet(SbgInterface *pInterface, const char *pName)
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileWrite(SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
SBG_COMMON_LIB_API size_t sbgInterfaceFileGetCursor(const SbgInterface *pHandle)
#define SBG_UNUSED_PARAMETER(x)
SbgInterfaceFlushFunc pFlushFunc
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileRead(SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
SbgInterfaceWriteFunc pWriteFunc
enum _SbgErrorCode SbgErrorCode
This file implements a file interface for read only operations.