Is there a better way than simply trying to open the file?
int exists(const char *fname) { FILE *file; if ((file = fopen(fname, \"r\"))) {
You can use realpath() function.
resolved_file = realpath(file_path, NULL); if (!resolved_keyfile) { /*File dosn't exists*/ perror(keyfile); return -1; }