diff options
author | inmarket <inmarket@ugfx.io> | 2017-06-24 16:35:31 +1000 |
---|---|---|
committer | inmarket <inmarket@ugfx.io> | 2017-06-24 16:35:31 +1000 |
commit | 8561671cb8c8c81cca6407d47437a7238b111ada (patch) | |
tree | 02525a8d232375498816d1ad8c051cd86ac933cf /3rdparty/fatfs-0.10b/doc/img/app1.c | |
parent | 5c848859956d62098aa88fdb524faf8bf17fc386 (diff) | |
download | uGFX-8561671cb8c8c81cca6407d47437a7238b111ada.tar.gz uGFX-8561671cb8c8c81cca6407d47437a7238b111ada.tar.bz2 uGFX-8561671cb8c8c81cca6407d47437a7238b111ada.zip |
Upgrade to from FATFS-0.10b to FATFS-0.13
Diffstat (limited to '3rdparty/fatfs-0.10b/doc/img/app1.c')
-rw-r--r-- | 3rdparty/fatfs-0.10b/doc/img/app1.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/3rdparty/fatfs-0.10b/doc/img/app1.c b/3rdparty/fatfs-0.10b/doc/img/app1.c deleted file mode 100644 index b3ff7fd7..00000000 --- a/3rdparty/fatfs-0.10b/doc/img/app1.c +++ /dev/null @@ -1,43 +0,0 @@ -/*------------------------------------------------------------/ -/ Open or create a file in append mode -/------------------------------------------------------------*/ - -FRESULT open_append ( - FIL* fp, /* [OUT] File object to create */ - const char* path /* [IN] File name to be opened */ -) -{ - FRESULT fr; - - /* Opens an existing file. If not exist, creates a new file. */ - fr = f_open(fp, path, FA_WRITE | FA_OPEN_ALWAYS); - if (fr == FR_OK) { - /* Seek to end of the file to append data */ - fr = f_lseek(fp, f_size(fp)); - if (fr != FR_OK) - f_close(fp); - } - return fr; -} - - -int main (void) -{ - FRESULT fr; - FATFS fs; - FIL fil; - - /* Open or create a log file and ready to append */ - f_mount(&fs, "", 0); - fr = open_append(&fil, "logfile.txt"); - if (fr != FR_OK) return 1; - - /* Append a line */ - f_printf(&fil, "%02u/%02u/%u, %2u:%02u\n", Mday, Mon, Year, Hour, Min); - - /* Close the file */ - f_close(&fil); - - return 0; -} - |