home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list16_3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
452b
|
22 lines
/* Reading formatted file data with fscanf(). */
#include <stdio.h>
main()
{
float f1, f2, f3, f4, f5;
FILE *fp;
if ( (fp = fopen("INPUT.TXT", "r")) == NULL)
{
fprintf(stderr, "Error opening file.");
exit(1);
}
fscanf(fp, "%f %f %f %f %f", &f1, &f2, &f3, &f4, &f5);
printf("The values are %f, %f, %f, %f, and %f.",
f1, f2, f3, f4, f5);
fclose(fp);
}