// Creating a sequential file
#include <stdio.h>
int main() {
FILE* cfPtr; // pointer to FILE structure
cfPtr = fopen("clients.txt","r");
if (cfPtr == NULL) {
puts("File could not be opened.");
}
else {
unsigned int account;
char name [30];
double balance;
printf("%-10s%-13s%s\n","Account","Name","Balance");
fscanf(cfPtr,"%d%29s%lf",&account,name,&balance);
while (!feof(cfPtr)) {
printf("%-10s%-13s%7.2f\n",account,name,balance);
fscanf(cfPtr,"%d%29s%lf",&account,name,&balance);
}
fclose(cfPtr);
}
I can write records to the file but i can not read and print the records in this file to the console.