很简单的一个功能,现在写的是将源文件写死的
#include "stdafx.h"
int main(void)
{
char filename;
FILE* file=fopen("F:\\wz-mac.txt","r"); //打开文件
while((filename=fgetc(file))!=EOF)
{
printf("%c",filename); //打印内容到屏幕
}
return 0;
}
#include
main()
{
FILE *fp;
char ch;
if((fp=fopen("c:\\stu.txt","rt+"))==NULL)
{
printf("\nCannot open file strike any key exit!");
getch();
exit(1);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
}
#include
void main()
{
FILE * fp;
char buffer[102400] = {0};
fp = fopen( "a.txt", "rb" );
fread( buffer, sizeof( char ), 102400, fp );
fclose(fp);
printf( "%s\n", buffer );
}