While(!feof(file))...... not working

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.16.00
Platform: ubuntu

hello rooters,
I am using while(!feof(file)){ process file } in my code so that if there are files missing in my folder, the loop will not terminate until all files are read, I have .dat fles in my folder I am reading files from. Anyone, who can help me.
Towseef Rehman

Hi Towseef,
this does not seem to be related to ROOT?
See e.g. here for example code that reads lines from a text file in C++.

Hope this helps!

Hey Enrico,
I basically loop over the files in my folder, the file name is auau.0000.dat and goes up to auau.04999.dat, there are some files missing in between, I want to skip those files and continue.
thanks, Enrico

See the example code I linked, the line that checks whether the file was opened correctly is if(!file).

Note that as this is a pure C++ question you will find a lot of tutorials and explanations on the web.


Thankyou, Enrico