Changeset 35 in libcf for trunk/include/cf_file.h
- Timestamp:
- 02/05/13 18:18:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_file.h
r34 r35 4 4 * @version 0.1 5 5 * 6 * @section 샘플코드 7 * @code 8 9 #include "cf_file.h" 10 11 int main (void) { 12 int fd = 0; 13 char *name = "file.txt"; 14 char buffer[128] = {0x00,}; 15 16 fd = CF_File_Create (name); 17 if (fd < 0) { 18 // error 19 } 20 if (CF_File_Write (fd, "file test", 9) < 0) { 21 // error 22 } 23 CF_File_Close (fd); 24 25 fd = CF_File_Open (name, CF_FILE_RO); 26 if (fd < 0) { 27 // error 28 } 29 printf ("file size : %d\n", CF_File_GetSize (fd)); 30 if (CF_File_Read (fd, buffer, sizeof (buffer)) < 0) { 31 // error 32 } 33 CF_File_Close (fd); 34 35 return 0; 36 } 37 38 * @endcode 6 * @example file.c 39 7 */ 40 8 #ifndef __CF_FILE_H__ … … 66 34 #endif 67 35 68 /**69 * 파일 열기70 *71 * @return 성공 시, 파일 디스크립터; 실패 시, 오류 코드72 *73 * @param path 파일 경로74 * @param flag 파일 열기 플래그75 *76 * @see CF_FILE_FLAG77 */78 36 CF_EXPORT int 79 37 CF_File_Open (const char * path, 80 38 const CF_FILE_FLAG flag); 81 39 82 /** 83 * 파일 닫기 84 * 85 * @return 성공 시, CF_OK; 실패 시, 오류 코드 86 * 87 * @param fd 파일 디스크립터 88 */ 40 CF_EXPORT int 41 CF_File_Create (const char * path); 42 89 43 CF_EXPORT int 90 44 CF_File_Close (const int fd); 91 45 92 /**93 * 파일 생성94 *95 * @return 성공 시, 파일 디스크립터; 실패 시, 오류 코드96 *97 * @param path 파일 경로98 */99 CF_EXPORT int100 CF_File_Create (const char * path);101 102 /**103 * 파일 읽기104 *105 * @return 성공 시, 읽은 바이트 수; 실패 시, 오류 코드106 *107 * @param fd 파일 디스크립터108 * @param buf 데이터를 저장할 메모리109 * @param len 데이터를 저장할 메모리의 크기110 */111 46 CF_EXPORT int 112 47 CF_File_Read (const int fd, … … 114 49 const size_t len); 115 50 116 /**117 * 파일 쓰기118 *119 * @return 성공 시, CF_OK; 실패 시, 오류 코드120 *121 * @param fd 파일 디스크립터122 * @param buf 데이터가 저장된 메모리123 * @param len 쓸 데이터의 길이124 */125 51 CF_EXPORT int 126 52 CF_File_Write (const int fd, … … 128 54 const size_t len); 129 55 130 /**131 * 파일 크기 얻기132 *133 * @return 성공 시, 파일 크기; 실패 시, 오류 코드134 *135 * @param fd 파일 디스크립터136 */137 56 CF_EXPORT int 138 57 CF_File_GetSize (const int fd);
Note:
See TracChangeset
for help on using the changeset viewer.