We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I need two directories to save some data.One directory save runing log and another save my last program image. I try to use following code to create ABC directory .but faild.
hFile = fopen("S:\\ABC\\1.txt","w"); if(hFile) //In herer ,hFile = 0 { fclose(hFile); fdelete("S:\\ABC\\1.txt"); }
How to create a directory?Who can help me to solve it . thanks !
It's a bit interesting that the Keil documentation has examples that shows of a path used when creating a file will place the file in that directory - but their function reference doesn't document any function for creating or removing any sub-directories.
The fopen() documentation contains the information: "filename can include a path. If the path does not exist, all subfolders are created."
So it sounds like your code should create the subdirectory and then the file on a SPI file system.
Thanks for your replay. I found the problem finally. First, i wrote "w" in uppercase.so the hFile is invalid. Second,SPI Flash base on EFS. RL-FlashFS » Embedded File System » Limitations contains the information: Directories or folders are not supported. File names are preprocessed to remove the path information for non-FAT file systems. So i can't create any subdirectory on a SPI file system.