#include <stdio.h>
void main (void)
{
FILE *fp;
char ch;
int pages = 892;
float price = 39.95;
if (fp = fopen(“FPRINTF.dat”, “w”))
{
fprintf(fp, “Book Title: Jamsa’s 1001 C & C++ Tips\n”);
fprintf(fp, “Pages: %d\n”, pages);
fprintf(fp, “Price: $%5.2f\n”, price);
fclose(fp);
}
else
{
printf(“Error opening FPRINTF.DAT\n”);
}
if(fp=fopen(“FPRINTF.dat”,”r”))
while(ch=fgetc(fp)!=EOF)
{
putchar(ch);
}
fclose(fp);
}
输出很奇怪..不知道什么来的!
Press any key to
continue
>> 本文固定链接: http://www.vcgood.com/archives/3006
只要不按照规则输出就可以了