91学习

陪伴你每一天!

rewind()函数输出两遍

#include <stdio.h>

#include <process.h>

void main(){

FILE *fp;

char ch,filename[30];

printf("please input filename:\n");

scanf("%s",filename);

if((fp=fopen(filename,"r"))==NULL){

printf("can not open file:\n");

exit(0);

}

ch=fgetc(fp);

while(ch!=EOF){

ch=putchar(ch);

ch=fgetc(fp);

}

rewind(fp);

printf("\n");

ch=fgetc(fp);

while(ch!=EOF){

ch=putchar(ch);

ch=fgetc(fp);

}

printf("\n");

fclose(fp);

}

加威信18790284560免费送POS机.jpg

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。