首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > Ruby Rails >

strerror函数的施用

2012-09-20 
strerror函数的使用?char * strerror ( int errnum )Get pointer to error message string?Interprets th

strerror函数的使用

?

char * strerror ( int errnum );

Get pointer to error message string

?

Interprets the value of errnum generating a string describing the error that usually?

?

generates that error number value in calls to functions of the C library.?

?

The returned pointer points to a statically allocated string, which shall not be modified by?

?

the program. Further calls to this function will overwrite its content.

?

The error strings produced by strerror depend on the developing platform and compiler.

?

Parameters

errnum

Error number.

?

Return Value

A pointer to the error string describing error errnum.?

?

?

Example

?

/* strerror example : error list */#include <stdio.h>#include <string.h>#include <errno.h>int main (){  FILE * pFile;  pFile = fopen ("unexist.ent","r");  if (pFile == NULL)    printf ("Error opening file unexist.ent: %s\n",strerror(errno));  return 0;}

?

?

Error opening file unexist.ent: No such file or directory

?

?

perror

热点排行