Printing unix error codes | Unix Linux Forums | UNIX and Linux Applications

  Go Back    


UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

Printing unix error codes

UNIX and Linux Applications


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-07-2009
vijaya2006 vijaya2006 is offline
Registered User
 
Join Date: Feb 2006
Last Activity: 4 August 2010, 1:42 AM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Question Printing unix error codes

Hi Friends,

I need your help in understanding this:

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:

Code:
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

Last edited by pludi; 10-07-2009 at 03:31 PM.. Reason: code tags, please...
Sponsored Links
    #2  
Old 10-07-2009
pludi's Avatar
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
You might want to take a look at perror

Last edited by pludi; 10-28-2009 at 07:53 AM..
Sponsored Links
    #3  
Old 10-07-2009
فارس الأحزان فارس الأحزان is offline
Banned
 
Join Date: Oct 2009
Last Activity: 11 October 2009, 5:56 AM EDT
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
very thanks vijaya2006
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do you Sum UNIX return codes z1tt45uuprs7 UNIX for Dummies Questions & Answers 3 10-18-2006 11:46 AM
how to write c codes in UNIX rraajjiibb Programming 12 02-01-2006 11:41 PM
pSeries 610 error codes dangral AIX 2 11-15-2005 05:33 PM
GNU's make error codes - list vino UNIX for Advanced & Expert Users 1 06-30-2005 12:47 PM
Printing Problems in unix ... ( Bar-cdoe - Ip Printing) QuickSilver UNIX for Advanced & Expert Users 3 06-04-2002 10:48 AM



All times are GMT -4. The time now is 05:37 PM.