原文:http://zhidao.baidu.com/question/245880406.html

#include <stdio.h>
#include <stdlib.h>
#define MAXLINE 100
int main()
{

FILE *fp;
char arr[MAXLINE+1];

if ((fp = fopen ("MYFILE", "r")) == NULL)
{
perror ("File open error!\n");
exit (1);
}
while ((fgets (arr, MAXLINE, fp)) != NULL)
{
fputs (arr, stdout);
}
return 0;
}
posted on 2011-06-21 10:51  hotty  阅读(1229)  评论(0)    收藏  举报