What's the best way to read an input file where the test cases are separeted by line breaks or blank lines, instead of having an explicit counter?
Example:
Code: Select all
this is test case one
this is test case two
Code: Select all
2
5 this is test case one
5 this is test case two
For the first case, I have been reading the input with fgets into a string and processing its elements with sscanf, but it's quite boring and very little elegant this way. Can anybody share a better alternative?
Thanks in advance![/code]