Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 28
    fopen() is standard C, it's not going anywhere. It's only "deprecated" by Microsoft. Don't use fopen_s() unless you want platform-specific, non-portable code. Commented Mar 1, 2017 at 9:54
  • This is the most compatible for all systems old and new. Commented Jul 14, 2017 at 14:09
  • where is the boolean set? Commented Sep 19, 2019 at 13:58
  • Seems to be an inefficient way to do this. The fact that this is the only 'compatible' way shows that the C filesystem interface is wanting. Commented Mar 7, 2023 at 3:42
  • Always use r+ as file mode instead of r to check if a file exists, since mode r can return non-NULL when opening a directory (confirmed on Linux), while r+ does not. Commented Feb 5, 2024 at 17:53