0

I am reading strings in from a data file in C using fscanf() using a loop that goes until EOF. The data file contains strings separated by any white space. As the strings are read in with fscanf() they will be checked for any invalid information. I need to keep track of the line numbers that an item is on so that if an invalid item is detected the line number of that item will be displayed. Like I said though, the data file is not just one string per line. Is there anything more elegant than reading in everything up to a new line, splitting that into individual strings, and checking those strings? Can I determine the line number where the file pointer is currently pointing?

4

1 に答える 1