Printing unix error codes

Hi Friends,

I need your help in understanding this: :rolleyes:

I want to print the error numbers returned by the system calls (not the actual integers but the strings that they match to). The error numbers like EACCESS, ENOMEM, ENOENT etc ...

For eg:

returnCode = open(somefile, O_RDONLY);

if (returnCode < 0) {

/* Handle the error */

printf("Error %d occured\n",errno);

}

>>>>This will print the error number in terms of integer. I want to get exactly the error code ( EACCESS, or ENOMEM ) etc ..

Thanks in Advance :slight_smile:

You might want to take a look at perror

very thanks vijaya2006