?
? ????? PHP ??? ???? ??? ?? ??
在頭文件<stdio.h>中定義 | ||
---|---|---|
void perror(const char * s); |
打印到stderr
由s
(由s
空指針指向的)以空字符結(jié)尾的字符串的內(nèi)容,后跟兩個(gè)字符": "
,后面跟著實(shí)現(xiàn)定義的錯(cuò)誤消息,描述當(dāng)前存儲(chǔ)在系統(tǒng)變量中的錯(cuò)誤代碼errno
(與輸出strerror(errno)
),然后'\n'
。
s | - | 指向帶有解釋性消息的以空字符結(jié)尾的字符串 |
---|
(none).
#include <stdio.h> int main(void){ FILE* f = fopen("non_existent", "r"); if (f == NULL) { perror("open()"); } else { fclose(f); }}
輸出:
open(): No such file or directory
C11 standard (ISO/IEC 9899:2011):
7.21.10.4 The perror function (p: 339)
C99 standard (ISO/IEC 9899:1999):
7.19.10.4 The perror function (p: 305)
C89/C90 standard (ISO/IEC 9899:1990):
4.9.10.4 The perror function