2012年1月11日 星期三

perror

Goal: will show the error number corresponding to string

Sample:

標頭檔: #include

函式定義: void perror(const char *s);

說明

perror 會將錯誤值對應到的錯誤訊息列印到標準錯誤串流中。

範例

/*perror 將錯誤編碼轉誠文字*/ #include   int main() {     FILE *stream;      if((stream = fopen("open", "r")) == NULL){  perror("fopen");     }      return 0; }


Output:
fopen: No such file or directory

沒有留言:

張貼留言