source: libcf/trunk/include/cf_file.h@ 16

Last change on this file since 16 was 16, checked in by cheese, 11 years ago

#1 add function for non-context debugging message printing

File size: 1.1 KB
Line 
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
18typedef 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,
23 CF_FILE_TR = O_TRUNC
24} E_CF_FILE_FLAG, CF_FILE_FLAG;
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30CF_EXPORT int
31CF_File_Open (const char * path,
32 const CF_FILE_FLAG flag);
33
34CF_EXPORT int
35CF_File_Close (const int fd);
36
37CF_EXPORT int
38CF_File_Create (const char * path);
39
40CF_EXPORT int
41CF_File_Read (const int fd,
42 void * buf,
43 const size_t len);
44
45CF_EXPORT int
46CF_File_Write (const int fd,
47 const void * buf,
48 const size_t len);
49
50CF_EXPORT int
51CF_File_GetSize (const int fd);
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif // #ifndef __CF_FILE_H__
Note: See TracBrowser for help on using the repository browser.