mercredi 3 août 2022

How to abort when the number of rows in the file is less than the number of rows read in the target in C++? [closed]

Now I have a txt file like this:

5

1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
5

1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
...

One loop of this file is 7 lines, and the second line of the 7 lines is a blank line. My file has N loops, but when my code is set to read N+100 loops, the code will not report an error, how should I modify the code to report an error at the end of the file, pay attention to my text file a blank line appears.

Aucun commentaire:

Enregistrer un commentaire