I have the follow C code to read a line from a file "store-data.txt" into a C string "record"
and then I use the sscanf to convert into two strings and a floating point with the format string:
char format1 = "%s %s %6.2f" and the file contains
"Royal_Crown CrownRoyal 35.99"
The problem is it doen't read the floating point correctly while after taking the two strings.
The output was:
Got the record from the file: Royal_Crown CrownRoyal 35.99
Royal_Crown CrownRoyal 1.22298e-38
------------------ The code:
infile.getline(record,80); // read in a line from store-data.txt, into "record"
cout << "Got the record from the file: " << record << endl;
num_words = sscanf(record,format1,field_winename,