/** * cf_file.h */ #ifndef __CF_FILE_H__ #define __CF_FILE_H__ #include "cf_base.h" #include #define CF_ERROR_FILE_OPEN CF_ERROR_FILE - 1 #define CF_ERROR_FILE_INVALID_ARGS CF_ERROR_FILE - 2 #define CF_ERROR_FILE_READ CF_ERROR_FILE - 3 #define CF_ERROR_FILE_WRITE CF_ERROR_FILE - 4 #define CF_ERROR_FILE_CREATE CF_ERROR_FILE - 5 #define CF_ERROR_FILE_CLOSE CF_ERROR_FILE - 6 #define CF_ERROR_FILE_GET_SIZE CF_ERROR_FILE - 7 typedef enum{ CF_FILE_RO = O_RDONLY, CF_FILE_WO = O_WRONLY, CF_FILE_WR = O_RDWR, CF_FILE_CR = O_CREAT, CF_FILE_TR = O_TRUNC, CF_FILE_AP = O_APPEND } E_CF_FILE_FLAG, CF_FILE_FLAG; #ifdef __cplusplus extern "C" { #endif CF_EXPORT int CF_File_Open (const char * path, const CF_FILE_FLAG flag); CF_EXPORT int CF_File_Close (const int fd); CF_EXPORT int CF_File_Create (const char * path); CF_EXPORT int CF_File_Read (const int fd, void * buf, const size_t len); CF_EXPORT int CF_File_Write (const int fd, const void * buf, const size_t len); CF_EXPORT int CF_File_GetSize (const int fd); #ifdef __cplusplus } #endif #endif // #ifndef __CF_FILE_H__