Rev | Line | |
---|
[4] | 1 | /**
|
---|
| 2 | * cf_file.h
|
---|
| 3 | */
|
---|
| 4 | #ifndef __CF_FILE_H__
|
---|
| 5 | #define __CF_FILE_H__
|
---|
| 6 |
|
---|
| 7 | #include "cf_base.h"
|
---|
| 8 | #include <fcntl.h>
|
---|
| 9 |
|
---|
| 10 | #define CF_ERROR_FILE_OPEN CF_ERROR_FILE - 1
|
---|
| 11 | #define CF_ERROR_FILE_INVALID_ARGS CF_ERROR_FILE - 2
|
---|
| 12 | #define CF_ERROR_FILE_READ CF_ERROR_FILE - 3
|
---|
| 13 | #define CF_ERROR_FILE_WRITE CF_ERROR_FILE - 4
|
---|
| 14 | #define CF_ERROR_FILE_CREATE CF_ERROR_FILE - 5
|
---|
| 15 | #define CF_ERROR_FILE_CLOSE CF_ERROR_FILE - 6
|
---|
| 16 | #define CF_ERROR_FILE_GET_SIZE CF_ERROR_FILE - 7
|
---|
| 17 |
|
---|
[16] | 18 | typedef enum{
|
---|
| 19 | CF_FILE_RO = O_RDONLY,
|
---|
| 20 | CF_FILE_WO = O_WRONLY,
|
---|
| 21 | CF_FILE_WR = O_RDWR,
|
---|
| 22 | CF_FILE_CR = O_CREAT,
|
---|
[17] | 23 | CF_FILE_TR = O_TRUNC,
|
---|
| 24 | CF_FILE_AP = O_APPEND
|
---|
[16] | 25 | } E_CF_FILE_FLAG, CF_FILE_FLAG;
|
---|
[15] | 26 |
|
---|
[4] | 27 | #ifdef __cplusplus
|
---|
| 28 | extern "C" {
|
---|
| 29 | #endif
|
---|
| 30 |
|
---|
| 31 | CF_EXPORT int
|
---|
[16] | 32 | CF_File_Open (const char * path,
|
---|
| 33 | const CF_FILE_FLAG flag);
|
---|
[4] | 34 |
|
---|
| 35 | CF_EXPORT int
|
---|
[12] | 36 | CF_File_Close (const int fd);
|
---|
[4] | 37 |
|
---|
| 38 | CF_EXPORT int
|
---|
| 39 | CF_File_Create (const char * path);
|
---|
| 40 |
|
---|
| 41 | CF_EXPORT int
|
---|
| 42 | CF_File_Read (const int fd,
|
---|
| 43 | void * buf,
|
---|
| 44 | const size_t len);
|
---|
| 45 |
|
---|
| 46 | CF_EXPORT int
|
---|
| 47 | CF_File_Write (const int fd,
|
---|
| 48 | const void * buf,
|
---|
| 49 | const size_t len);
|
---|
| 50 |
|
---|
| 51 | CF_EXPORT int
|
---|
| 52 | CF_File_GetSize (const int fd);
|
---|
| 53 |
|
---|
| 54 | #ifdef __cplusplus
|
---|
| 55 | }
|
---|
| 56 | #endif
|
---|
| 57 |
|
---|
| 58 | #endif // #ifndef __CF_FILE_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.