source: libcf/trunk/test/file.c@ 35

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

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

File size: 572 bytes
Line 
1/**
2 * @file file.c
3 * @author myusgun <myusgun@gmail.com>
4 * @version 0.1
5 */
6#include "cf_file.h"
7#include <stdio.h>
8
9int main (void) {
10 int fd = 0;
11 char *name = "file.txt";
12 char buffer[128] = {0x00,};
13
14 fd = CF_File_Create (name);
15 if (fd < 0) {
16 // error
17 }
18 if (CF_File_Write (fd, "file test", 9) < 0) {
19 // error
20 }
21 CF_File_Close (fd);
22
23 fd = CF_File_Open (name, CF_FILE_RO);
24 if (fd < 0) {
25 // error
26 }
27 printf ("file size : %d\n", CF_File_GetSize (fd));
28 if (CF_File_Read (fd, buffer, sizeof (buffer)) < 0) {
29 // error
30 }
31 CF_File_Close (fd);
32
33 return 0;
34}
Note: See TracBrowser for help on using the repository browser.