Jump to content
  • Advertisement
Sign in to follow this  
Alex Swinney

Win32 Check for file?

This topic is 4959 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

Is there any way to check if a file exists WITHOUT creating it in Win32 or c++? I've tried C++, I don't get anything except empty files that were created when I tried to check their existence. Thanks

Share this post


Link to post
Share on other sites
Advertisement
In C++ a std::ifstream shouldn't create a new file if it doesn't exist. Otherwise in Win32, you should be able to use CreateFile() with the OPEN_EXISTING flag.

Share this post


Link to post
Share on other sites
I'm sure fopen() also has a flag that turns off the auto creation as well ... google will show you the way!

Edit: Infact if you open a file for reading it should never be created if it doesn't exist - it should just fail!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!