Arrg!! Simple fileIO question, easy 200 PTS! HELP!!
Posted on 2003-03-28
Don't ask why but I'm stuck in a C class and I can't use C++ for what I need to do. Before you read on, If your any geek who's going to waste my time with "no homework" comments, don't. It's a simple syntax problem and I wouldn't be posting if I didn't already waste 2 hours on this. Your getting paid in points so...
if( you can help)
I'm reading from a file and I need to detect a delimiter that separates two values on a line, I've been trying to use
fscanf, but can't find any clear documetation on setting it to stop at a delimiter.
Here's an example of the line being read:
Doe, John; GPA=3.4
I need to read "Doe, John" into a *string, and 3.4 into another.
The list is going to have names of varying length so I can't use a set value length to read.
I need to read the line up until the semi colon. How?
After that I'm going to use GPA=%f to read the grade value. I think I got that right?
I need to pull about 50 names in a linked list and sort it all alphabetically, then do a bunch of various deletes, insertions and outputs,
but I'm stuck from the get go on this stupid syntax issue.
could someone explain:
fscanf(*filename," \"%[^\"];, %*c);
and show me how to write this line to do what I need ?