#include <stdio.h>
#include <errno.h>
#include <string.h>
extern int errno ;
int main () {
FILE *fp;
fp = fopen("file.txt", "r");
if( fp == NULL ) {
fprintf(stderr, "Value of errno: %d/n", errno);
fprintf(stderr, "Error opening file: %s/n", strerror(errno));
} else {
fclose(fp);
}
return(0);
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/265185.html