Posted in 面试题 onJanuary 05, 2015
解:#include
main()
#define m 20
{
char str1[m];
int i;
FILE *fp1;
if((fp1=fopen(“file2.c”,”r”))==NULL)
{
printf(“cannot open the file\n”);
exit(0);
}
i=0;
While(!feof(fp1))
{
strl[i]=fgetc(fp1);
i++;
}
while(i!=0)
{
i–;
Putchar(str1[i]);
}
fclose(fp1);
}
main()
#define m 20
{
char str1[m];
int i;
FILE *fp1;
if((fp1=fopen(“file2.c”,”r”))==NULL)
{
printf(“cannot open the file\n”);
exit(0);
}
i=0;
While(!feof(fp1))
{
strl[i]=fgetc(fp1);
i++;
}
while(i!=0)
{
i–;
Putchar(str1[i]);
}
fclose(fp1);
}
将一个文本文件的内容按倒序打印出来
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@