romanrdgz
Joined: 28 Jan 2011 Posts: 16
|
Best way to check if a file exists (fat.c) |
Posted: Fri Aug 19, 2011 4:35 am |
|
|
Hi,
I'm using fat.c library to create files and writing data into them. First of all, I'm checking if file_001.txt exists. If does exist, I'll then check if file_002.txt exists, and so on until I find one that doesn't exist and I'll create a new file to work with it.
To do that check, I'm calling fatopen method, so if it returns GOODEC, then the file exists (library has opened the file). If it returns anything different (EOF), then it doesn't exist.
The problem is that sometimes an error occurs, so it returns EOF even when the file does exist.
So my question is, is there a better way to check if a file exists, without having to open it?
Thanks for your time |
|