A
AMT2K5
Hello.
I have a file (for a school assignment) with the following format and
delimiter format. Each record in the file has the following format:
123423454567987,29873,James,Harry,St. Louis,416-555-5555;
"accountNumber,balance,lastName,city,phoneNumber;" Each record is
guranteed to be no longer than 350 characters. "balance" is no longer
than 20 characters, "accountNumber" is exactly 15 characters and the
total number of characters in "lastName,firstName,city,phoneNumber;"
is
no longer than 315 characters. Copy the fields in this record to the
appropriate data member of the first empty Account in the array
savings, using all the rules for copying (initializing).
Contents of a3.dat
123423454567987,29873,James,Harry,St.
Louis,416-555-5555;223423454567987,198745,Jones,Beth,Toronto,416-555-5556;323423454567987,2349,Ng,Wei,Montreal,416-555-5557;423423454567987,9234617,Woo,Charles,Winnipeg,416-555-5558;523423454567987,2534,DeJesus,Pancho,Edmonton,416-555-5559;623423454567987,543876,Smith,Bob,Charlottetown,416-555-5544;723423454567987,1234,Kasim,Vladislov,Halifax,416-555-5566;823423454567987,98765,Yamaha,David,Vancouver,416-555-5577;923423454567987,26486,Lee,Jim,Calgary,416-555-5588;113423454567987,83456,Baker,Susan,St.
Louis-de-ha-ha,416-555-5599;133423454567987,29873,James,Harry,St.
Louis,416-555-5555;
Since each "record" is not a line and is shown as is (above) in the
file, how might I go and read each "record", extract the information
and send it to the correct data member of the first empty object in the
array?
So far I have my function like this
void Bank::workFP(FILE* fp)
{
if(fp != NULL){
}
else printf("Unable to open file.\n");
}
Thanks in advance. Appreciate any help whatsoever.
I have a file (for a school assignment) with the following format and
delimiter format. Each record in the file has the following format:
123423454567987,29873,James,Harry,St. Louis,416-555-5555;
"accountNumber,balance,lastName,city,phoneNumber;" Each record is
guranteed to be no longer than 350 characters. "balance" is no longer
than 20 characters, "accountNumber" is exactly 15 characters and the
total number of characters in "lastName,firstName,city,phoneNumber;"
is
no longer than 315 characters. Copy the fields in this record to the
appropriate data member of the first empty Account in the array
savings, using all the rules for copying (initializing).
Contents of a3.dat
123423454567987,29873,James,Harry,St.
Louis,416-555-5555;223423454567987,198745,Jones,Beth,Toronto,416-555-5556;323423454567987,2349,Ng,Wei,Montreal,416-555-5557;423423454567987,9234617,Woo,Charles,Winnipeg,416-555-5558;523423454567987,2534,DeJesus,Pancho,Edmonton,416-555-5559;623423454567987,543876,Smith,Bob,Charlottetown,416-555-5544;723423454567987,1234,Kasim,Vladislov,Halifax,416-555-5566;823423454567987,98765,Yamaha,David,Vancouver,416-555-5577;923423454567987,26486,Lee,Jim,Calgary,416-555-5588;113423454567987,83456,Baker,Susan,St.
Louis-de-ha-ha,416-555-5599;133423454567987,29873,James,Harry,St.
Louis,416-555-5555;
Since each "record" is not a line and is shown as is (above) in the
file, how might I go and read each "record", extract the information
and send it to the correct data member of the first empty object in the
array?
So far I have my function like this
void Bank::workFP(FILE* fp)
{
if(fp != NULL){
}
else printf("Unable to open file.\n");
}
Thanks in advance. Appreciate any help whatsoever.