Can anybody tell me the usage of perror in C language.
Please give me a simple example along with its sample run of the program.Thanks.
Can anybody tell me the usage of perror in C language.
Please give me a simple example along with its sample run of the program.Thanks.
Man entry:
http://www.hmug.org/man/3/perror.php
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
may be this one
When error occurs the global variable errno will be initialized with the error code.Code:#include <errno.h> int sock; if( ( sock = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 ) { perror("socket"); return -l; }
ssharish