strerror_r.c

来自「KPIT GNU Tools is a set of GNU developme」· C语言 代码 · 共 54 行

C
54
字号
/*FUNCTION	<<strerror_r>>---convert error number to string and copy to bufferINDEX	strerror_rANSI_SYNOPSIS	#include <string.h>	char *strerror_r(int <[errnum]>, char *<[buffer]>, size_t <[n]>);TRAD_SYNOPSIS	#include <string.h>	char *strerror_r(<[errnum]>, <[buffer]>, <[n]>)	int <[errnum]>;	char *<[buffer]>;	size_t <[n]>;DESCRIPTION<<strerror_r>> converts the error number <[errnum]> into astring and copies the result into the supplied <[buffer]> fora length up to <[n]>, including the NUL terminator. The value of <[errnum]> is usually a copy of <<errno>>.  If <<errnum>> is not a known error number, the result is the empty string.See <<strerror>> for how strings are mapped to <<errnum>>.RETURNSThis function returns a pointer to a string.  Your application mustnot modify that string.PORTABILITY<<strerror_r>> is a GNU extension.<<strerror_r>> requires no supporting OS subroutines.*/#undef __STRICT_ANSI__#include <errno.h>#include <string.h>char *_DEFUN (strerror_r, (errnum, buffer, n),	int errnum _AND	char *buffer _AND	size_t n){  char *error;  error = strerror (errnum);  return strncpy (buffer, (const char *)error, n);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?