1
2
3
,
4
5
6
ASCII
7
ASCII
ASCII
8
9
fp
FILE
FILE *fp
10
Fopen
NULL
FILE *fp;
fp=fopen(,)
11
r
w
a
r+ /
w+ /
a+f /
12
fopen
FILE *fp;
fp=open(“first.txt”,“w”);//
if (fp==NULL)
{
printf("Error");
exit(1);
}
13
FILE *fp;
fp=fopen(,)
fclose(fp)
14
fgetc()
fgetc()
15
fputc()
fputc(,)
16
#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *fp; char ch=' ';
fp=fopen("first.txt","w");
if (fp==NULL)
{
printf("Error"); exit(1);
}
printf("");
ch=getchar();
while (ch!='@')
{
fputc(ch,fp); ch=getchar();
}
fclose(fp); //
17
fp=fopen("first.txt","r");
if (fp==NULL)
{
printf("Error");
exit(1);
}
while (ch!=EOF)
{
ch=fgetc(fp);
putchar(ch);
}
getchar();
fclose(fp);
//
}
18
/
fputs
fgets
fputs(); fgets();
19
fwrite()
fread()
20
rb
wb
ab
r+b /
w+b /
a+b /
21
fwrite()
fwrite(buffersizecountfp)
22
fread()
fread(buffersize countfp)
23
buffer /
size /
count /
fp
24
25
fprintffscanf
printfscanf
fprintf( );
fscanf( );
26
feof()
rewind()
ferror()
remove()
fflush()
fseek()
27
rewind()
rewind(fp)