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.
Printable View
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
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