Dealing with nonexistent file input
The command to activate the program would be: (C under linux)
gcc program.c
./a.out infile outfile
I'm trying to deal with the user inputting a nonexistent infile. I tried
Code:
if (infile == Null){
printf("file not found");
return 0;
}
A book recommended using the "error function" which would be instead of print and return, I'd write <Error("file not found")> this throws an error during compiling though. "undefined reference to error." Maybe one of those books that assumes you included a library available on the books website, or maybe a C under linux thing...
So far I either get a bunch of unreadable stuff, or a segmentation error.