Does anyone know if this is a file function that allows me to check for the existence of a file before I try to open it?
Thanks
Does anyone know if this is a file function that allows me to check for the existence of a file before I try to open it?
Thanks
I was afraid that you were going to say that.
There must be some other return codes in errno.h that I can also use, I will just have to trawl through that.
Thanks
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
For determining the failure reason and returning a more meaningful message to the log file. I havent come across strerror() before, but looking at the man page it looks like it will do what I want. If I use the strerror function inside the fprintf function it should return the error message string to the log file, as:
fprintf(OUT_FILE, "Error: Error No: %i, Error message: %s\n", errno, strerror(errno));
Thanks v.helpful
Peter
If you're doing that, you might find these functions useful too (if you want to make your log writing code more friendly)
Code:void LogMessage(char *fmt, ...) { va_list arglist; va_start(arglist, fmt); vfprintf(stderr, fmt, arglist); va_end( arglist ); }
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]