Is there a better way than simply trying to open the file?
int exists(const char *fname)
{
FILE *file;
if ((file = fopen(fname, \"r\")))
{
I can't remember where I got this from that I used in my assignment (I usually copy paste the URL where I found it as an easy form of citation) and I cannot decipher what the trailing (file) = 0
is although my best guess is that it is redundancy to set any references to file to 0.
#define fclose(file) ((file) ? fclose(file) : 0, (file) = 0)
file
if a pointer declared as:
FILE *file=NULL;