c++ check if file exists
Are there any apis that check whether a file is existant from a string you pass in?
|
just open the file for reading, if this succeeds, then the file exists, something like this:
Code:
FILE* fp = fopen(path, "r"); |
A file? Like... to check if a file exists when you try to open or write to it? If so, try something like this:
Code:
#include<fstream> Regards! |
i do not have the exact syntax in front of me, but if i remember correctly that the open file function in output stream will return a value of 1 or 0 if/ifnot successful. the syntax above works, but you can use the test in alot other situations.
|
All times are GMT -5. The time now is 03:57 AM. |