0
bool file_exists(char* path) {
}

So I want to know on how I could make a function that's a Boolean that lets me know whether a file exists or not in C language using the access() function in C. What other functions would I need? I'm new to C and I'm coming from java just as a heads up. I haven't played around with accessing local files on computer from a program yet either so I'm just a bit stumped on what to do. Any help is appreciated!

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Aviera00
  • 1
  • 4
  • This is already answered [here](https://stackoverflow.com/questions/230062/whats-the-best-way-to-check-if-a-file-exists-in) – KarthikNayak98 Feb 15 '21 at 08:50
  • You are referring to the function named `access`. Such a function name does not exist in ISO C. However, it does exist in [POSIX](https://en.wikipedia.org/wiki/POSIX) systems (for example Linux operating systems) as a platform-specfic extension. If your question refers to POSIX systems, then please clarify this by adding the "posix" tag. If you want the solution to the problem to run on all ISO C compliant systems, then you should not add that tag, though. – Andreas Wenzel Feb 15 '21 at 12:49

0 Answers0