Checking if file exists cpp


















Necessary Necessary. Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information. Non-necessary Non-necessary. Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies.

Viewed 7k times. Improve this question. I guess your intent is to check whether the file is readable or not by your process. It is a bit different from just testing if this file exists; it could exist but your process may not be able to read its content permissions The first one looks better to me.

Why check if an arbitrary file-related function returns an error, if you can directly check if the file was opened correctly. Add a comment. Active Oldest Votes. Improve this answer. Peter Peter 7 7 silver badges 16 16 bronze badges. Although this is just a common solution, if you're not specific in your solution — Peter. Except you have something in mind to achieve and maybe the question wasn't properly asked.

Brian Bi Brian Bi The bad and fail bits are not always reset properly between calls, at least in my experience Note that there are difference between "File exist" and "File can be opened". Non-maskable Interrupt Non-maskable Interrupt 3, 1 1 gold badge 18 18 silver badges 26 26 bronze badges. Amit G. Jayhello Jayhello 4, 3 3 gold badges 42 42 silver badges 48 48 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related 2.



0コメント

  • 1000 / 1000