Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Intermediate
Apr 22, 2002

Translating errno Error Codes to Text


To translate an error code to its verbal description, use the function strerror(). strerror() is declared in <errno.h> as follows:
 
char * strerror(int errcode);

The function takes an error code and returns a statically allocated char array describing that code. Remember that subsequent calls to strerror() overwrite the description string. Therefore, you should copy it to a local buffer unless you intend to use it immediately. In the following example, strerror() translates the current errno code to a string which is then printed on the user
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date