-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.c
52 lines (41 loc) · 762 Bytes
/
Test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
int fr(){
FILE* fr = fopen("Std.txt","r");
char ch; //并不是字符串
char* chh = NULL;
int flag = 0;
int count = 0;
while ((ch=getch(fr))!=EOF)
{
}
}
int main(){
FILE* fr = NULL;
FILE* fw = NULL;
char ch;
if ((fr=fopen("Std.txt","r"))==NULL)
{
printf("NULL");
exit(0);
}
if ((fw=fopen("w.txt","w"))==NULL)
{
printf("NULL");
exit(0);
}
int i = 0;
while ((ch=fgetc(fr))!=EOF)
{
//putchar(ch);
if (ch=='\n')
{
i++;
}
putc(ch,fw);
}
fclose(fr);
fclose(fw);
printf("%d",i);
return 0;
}