I am trying to write a function to read data from an input file (specific format of the input file is as follows - each line is of the form: name score). Then, I want to break the string into a character string part and a number part, then perform manipulation on each. The name may contain any number of words with any amount of white space between them. No word in a name may be a number. The score is a floating point number.
Example sample data (taken from different data sets to illustrate different types of input data):
Cleveland .656
Nagy, Clev 227.0
President Mr. John Adams -71.86
The Wonderful World of Disney +0.101
I use fgets to read in the string (learned the hard way that scanf doesn't work well here). How do I test when a character string stops and the number begins? Would I have to test each character for a number or a special character followed by a number(-1, .5, +0)?