🦄 refactor(C13, C14, C115): 更新了linux系统开发部分的结构
This commit is contained in:
32
C13-IO/stdio/fgetc.c
Normal file
32
C13-IO/stdio/fgetc.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp;
|
||||
int count;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "Usage...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fp = fopen(argv[1], "r");
|
||||
if (NULL == fp)
|
||||
{
|
||||
perror("fopen()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (EOF != fgetc(fp))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
printf("count = %d", count);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user