- #include <stdio.h>
- void main (void)
- {
- FILE *fp;
- int pages = 892;
- float price = 39.95;
- if (fp = fopen("FPRINTF.DAT", "w"))
- {
- fprintf(fp, "Book Title: Jamsa's 1001 C & C++ Tipsn");
- fprintf(fp, "Pages: %dn", pages);
- fprintf(fp, "Price: $%5.2fn", price);
- fclose(fp);
- }
- else
- printf("Error opening FPRINTF.DATn");
- }