CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Best way to check if a file exists (fat.c)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
romanrdgz



Joined: 28 Jan 2011
Posts: 16

View user's profile Send private message

Best way to check if a file exists (fat.c)
PostPosted: Fri Aug 19, 2011 4:35 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group