标题:将文件中的字符显示在屏幕上
只看楼主
hehuihh2004
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-11-3
 问题点数:0 回复次数:0 
将文件中的字符显示在屏幕上
#include "stdio.h"
#define ERROR 0
main()
{
FILE *fp;
char ch;
printf("以下显示的便是该程序的源代码!\n");
if ((fp=fopen("c:\myfile.c","r"))==NULL)
{
printf("Can't open the file and press any key to exit\n");
getchar();
return ERROR;
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
printf("\n");
}
搜索更多相关主题的帖子: 屏幕 字符 文件 
2006-11-04 20:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-100760-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.361956 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved