Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Crispy

checkinf if a file exists

This topic is 6064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey what is the FASTEST way to check if a file exists. i''m fealing with a potentially large amount of files, so fopen(...)-ing and fclose(...)-ing each and every one of them on game startup would be a bit slow, wouldn''t it? thanks keep cool

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try OpenFile() with the OF_EXIST style. That doesn''t actually open the file, just checks for existance. IME, it''s pretty fast.

Share this post


Link to post
Share on other sites
Windows : try GetFileAttributes()
*nix : stat() or fstat()

Alternatively, you can check the contents of directories against the list of your files

Windows : FindFirstFile() and FindNextFile()
*nix : opendir() and readdir()

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!