2016-12-14 05:07 AM
Hi,
I am using fatfs sdcard stack, how can i create file in a directory? can i use f_open function for this? In f_open function i just specify the name of the file like this:
f_open(&MyFile, 'STM32.TXT', FA_CREATE_ALWAYS | FA_WRITE)
How can i add the directory path?
2016-12-14 09:13 AM
You could I suppose RTFM, FatFs is reasonably well documented.
http://elm-chan.org/fsw/ff/en/filename.html
http://elm-chan.org/fsw/ff/en/chdir.html
http://elm-chan.org/fsw/ff/en/mkdir.html
I'm pretty sure it won't create a fully qualified path, you need to make the directory tree before you can put a file there. You'd have to do it one node at a time using f_mkdir()
r_mkdir('/SOMEDIR');
f_open(&MyFile, '/SOMEDIR/SOMEFILE.TXT', FA_CREATE_ALWAYS | FA_WRITE)