Output of a text file
/*
===============================================================
Title: The contents of the output text file are displayed on the screen!
===============================================================
*/
#include <stdio.h>
#include <string.h>
void Main ()
{
FILE *FP;
Char ch;
Fp=fopen ("D:data.txt", "R");
if (fp==null)
printf ("Can not open!\n");
Else
{
FSCANF (FP, "%c", &ch);
while (!feof (FP))
{
Putchar (CH);
FSCANF (FP, "%c", &ch);
}
Fclose (FP);
}
printf ("\ n");
}
/*
===============================================================
Evaluation:
Read characters: fscanf (FP, "%c", &ch), CH=FGETC (FP);
===============================================================
*/
Copyright Notice: Bo Main article can be reproduced non-commercial, but please be sure to indicate the source, because the level is limited, inevitably error, in this disclaimer.
C Language File operation--the contents of the output text file are displayed on the screen