//fgetc和fput函数
//int main()
//{
// FILE* fp;
// char ch;
// fp= fopen("d:\\tl.txt", "w");//存在D盘的tl名中
// if (fp == NULL)
// exit(0);
// ch = getchar();
// while (ch!= '#')
// {
// fputc(ch, fp);
// ch = getchar();
// }
// fclose(fp);
// fp= fopen("d:\\tl.txt", "r");
// ch = fgetc(fp);//while(ch!=-1)
// while (!feof(fp))//判定文件是否到了末尾,到了末尾返回非零,不到末尾返回0
// //检查读的结果是否正确
// {
// putchar(ch);
// ch = fgetc(fp);
// }
// fclose(fp);
//
//}
//fputs fgets函数
//int main()
//{
// FILE* fp;
// char str[30];
// gets(str);
// fp= fopen("d:\\tl.txt", "w");//存在D盘的tl名中
// if (fp == NULL)
// exit(0);
// fputs(str,fp);
// fclose(fp);
// fp= fopen("d:\\tl.txt", "r");
// if (fp == NULL)
// exit(0);
// fgets(str, 30, fp);
// printf("%s", str);
// fclose(fp);
//
//}
//fscanf和fprintf函数
//int main()
//{
// FILE* fp;
// int a, b;
// fp= fopen("d:\\tl.txt", "w");//存在D盘的tl名中
// if (fp == NULL)
// exit(0);
//scanf("%d%d",&a,&b);
//fprintf(fp, "a=%d,b=%d", a, b);//先存到文件里
// fclose(fp);
// fp= fopen("d:\\tl.txt", "r");
// if (fp == NULL)
// exit(0);
// fscanf(fp, "%d,%d", &a, &b);//再读出文件中 存入的数据
// printf("a=%d,b=%d",a,b);
// fclose(fp);
//
//}
//fread函数和fwrite函数
//int main()
//{
// FILE* fp;
// int a[5],b[5];
// int i;
// fp= fopen("d:\\tl.txt", "wb");//存在D盘的tl名中
// if (fp == NULL)
// exit(0);
// for (i = 0; i < 5; i++)
// scanf("%d", &a[i]);
// fwrite(a, sizeof(int), 5, fp);
// fclose(fp);
// fp= fopen("d:\\tl.txt", "rb");
// if (fp == NULL)
// exit(0);
// fread(b, sizeof(int), 5, fp);
// for (i = 0; i < 5; i++)
// printf("%d", b[i]);
// fclose(fp);
//
//}
//fseek函数和rewind函数
//int main()
//{
// FILE* fp;
// char ch;
// fp= fopen("d:\\tl.txt", "w+");//存在D盘的tl名中
// if (fp == NULL)
// exit(0);
// ch = getchar();
// while (ch!= '#')
// {
// fputc(ch, fp);
// ch = getchar();
// }
// rewind(fp);
//ch = fgetc(fp);//while(ch!=-1)
// while (!feof(fp))
// {
// putchar(ch);
// ch = fgetc(fp);
// }
// fclose(fp);
//}
//int main()
//{
// FILE* fp;
// char ch;
// fp = fopen("d:\\tl.txt", "w");
// ch = getchar();
// while (ch!= '#')
// {
// fputc(ch, fp);
// ch = getchar();
// }
// if (fp == NULL)
// exit(0);
// fseek(fp, 1, 2);
// printf("%d\n", ftell(fp));
// rewind(fp);
// printf("%d\n", ftell(fp));//ftell确定指针当前的位置
// fclose(fp);
//
//}