Skip to content
On this page

strerror()


标签:linux/api  

函数简介

c
#include <string.h>
char *strerror(int errnum);

返回描述 errno 的字符串。

示例代码

c
int main()
{
  FILE *fp;

  fp = fopen("tmp", "r");
  if(fp == NULL)
  {
	fprintf(stderr, "fopen():%s\n", strerror(errno));
    exit(1);
  }
  puts("OK!");
  exit(0);
}

Last updated: