Skip to content

Commit

Permalink
[error] add perror_example
Browse files Browse the repository at this point in the history
  • Loading branch information
luhuadong committed Jan 31, 2023
1 parent f33a4f2 commit ef6690d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions error/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
gcc perror_example.c -o perror_example

clean:
rm perror_example
10 changes: 10 additions & 0 deletions error/perror_example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>

int main()
{
FILE *fp;
fp = fopen("/tmp/noexist", "r+");
if(fp == NULL)
perror("fopen");
return 0;
}

0 comments on commit ef6690d

Please sign in to comment.