Translate errno to error string

没几行的程序,就是输出errno数字所表示的对应含义

#include
#include
#include 

int main(int argc, char* argv[])
{
        if (argc == 1) {
                printf ("Please give a number, Thanks~~~\n");
                exit(1);
        }

        char tmp_str[20];
        errno = atoi(argv[1]);
        sprintf(tmp_str, "errno %3d", errno);
        perror(tmp_str);
}
This entry was posted in Happy coding and tagged . Bookmark the permalink.

2 Responses to Translate errno to error string

  1. xrdavies says:

    什么个思想感情。。

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>