I have a large textfile that contains data that changes over time. Each 'timestep', it starts a new section of the file, beginning with a ling that conatins a single integer value and nothing else. These lines are irregularly spaced since each timestep contains different amounts of information as the system evolves. I need a function that will count the number of timesteps (ei, count the number of lines that contain a single integer value and nothing else). How can I do this?
I though about using fgets to read in each line, but I have never worked with strings like that so I wouldn't know how to test the result properly. Is there a library function that can tell you if everything in a given string is a number with no decimal place?