Changeset 35 in libcf for trunk/include/cf_file.h


Ignore:
Timestamp:
02/05/13 18:18:37 (11 years ago)
Author:
cheese
Message:

#1 separate example code and doxygen comment and fix logging push logic by vfire

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/cf_file.h

    r34 r35  
    44 * @version 0.1
    55 *
    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
    397 */
    408#ifndef __CF_FILE_H__
     
    6634#endif
    6735
    68 /**
    69  * 파일 열기
    70  *
    71  * @return 성공 시, 파일 디스크립터; 실패 시, 오류 코드
    72  *
    73  * @param path  파일 경로
    74  * @param flag  파일 열기 플래그
    75  *
    76  * @see CF_FILE_FLAG
    77  */
    7836CF_EXPORT int
    7937CF_File_Open            (const char         * path,
    8038                         const CF_FILE_FLAG flag);
    8139
    82 /**
    83  * 파일 닫기
    84  *
    85  * @return 성공 시, CF_OK; 실패 시, 오류 코드
    86  *
    87  * @param fd 파일 디스크립터
    88  */
     40CF_EXPORT int
     41CF_File_Create          (const char * path);
     42
    8943CF_EXPORT int
    9044CF_File_Close           (const int fd);
    9145
    92 /**
    93  * 파일 생성
    94  *
    95  * @return 성공 시, 파일 디스크립터; 실패 시, 오류 코드
    96  *
    97  * @param path  파일 경로
    98  */
    99 CF_EXPORT int
    100 CF_File_Create          (const char * path);
    101 
    102 /**
    103  * 파일 읽기
    104  *
    105  * @return 성공 시, 읽은 바이트 수; 실패 시, 오류 코드
    106  *
    107  * @param fd    파일 디스크립터
    108  * @param buf   데이터를 저장할 메모리
    109  * @param len   데이터를 저장할 메모리의 크기
    110  */
    11146CF_EXPORT int
    11247CF_File_Read            (const int      fd,
     
    11449                         const size_t   len);
    11550
    116 /**
    117  * 파일 쓰기
    118  *
    119  * @return 성공 시, CF_OK; 실패 시, 오류 코드
    120  *
    121  * @param fd    파일 디스크립터
    122  * @param buf   데이터가 저장된 메모리
    123  * @param len   쓸 데이터의 길이
    124  */
    12551CF_EXPORT int
    12652CF_File_Write           (const int      fd,
     
    12854                         const size_t   len);
    12955
    130 /**
    131  * 파일 크기 얻기
    132  *
    133  * @return 성공 시, 파일 크기; 실패 시, 오류 코드
    134  *
    135  * @param fd    파일 디스크립터
    136  */
    13756CF_EXPORT int
    13857CF_File_GetSize         (const int fd);
Note: See TracChangeset for help on using the changeset viewer.