]>
cloudbase.mooo.com Git - z180-stamp.git/blob - fatfs/doc/img/app1.c
1 /*------------------------------------------------------------/
2 / Open or create a file in append mode
3 /------------------------------------------------------------*/
6 FIL
* fp
, /* [OUT] File object to create */
7 const char* path
/* [IN] File name to be opened */
12 /* Opens an existing file. If not exist, creates a new file. */
13 fr
= f_open(fp
, path
, FA_WRITE
| FA_OPEN_ALWAYS
);
15 /* Seek to end of the file to append data */
16 fr
= f_lseek(fp
, f_size(fp
));
30 /* Open or create a log file and ready to append */
32 fr
= open_append(&fil
, "logfile.txt");
33 if (fr
!= FR_OK
) return 1;
36 f_printf(&fil
, "%02u/%02u/%u, %2u:%02u\n", Mday
, Mon
, Year
, Hour
, Min
);