strerrorを使えとのことなので、strerrorの引数にerrnoを渡してみる。
strerror(errno)でも、
$ vi strerror.c $ gcc strerror.c -o strerror $ ./strerror errno = 0 errno = 2 strerror(errno) = No such file or directory fopen error!: No such file or directory $
"No such file or directory"となる。
Sample/c/strerror/strerror/src/strerror at master · bg1bgst333/Sample · GitHub