How to know if a file exists in C
Author | Message |
---|---|
Khranial | # Posted yesterday |
![]() |
Hi |
Ads | |
Clara | # Posted two hours ago |
![]() |
You can use FILE * fp = fopen("file.txt", "rb"); Don't forget to read the C tutorial, these types of questions are answered in depth. Also you may want to check out the FAQ. |
Valter | # Posted two hours ago |
![]() |
I don't like ^ #include <unistd.h> The access function here takes two parameters: path and amode. The F_OK argument checks if the file exists. You can also use R_OK , W_OK , or X_OK to check for read, write, or execute permissions, respectively. |
Phoenix | # Posted one hour ago |
![]() |
Bruh. Burned. |
Clara | # Posted one hour ago |
![]() |
My bad I should of checked before posting. But he did ask how to check if a file exists, not if it doesn't exist :° |
Khranial | # Posted 7 minutes ago |
![]() |
Yes it works now. Thanks for your answers! |
Post a reply
Please be kind and courteous in your replies. Don't roast others for no reason.