How to handle empty txt files when reading data in Fortran 90?

  • Context: Fortran 
  • Thread starter Thread starter toni_2374
  • Start date Start date
  • Tags Tags
    Data Fortran
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
toni_2374
Messages
5
Reaction score
0
Hi
I have a problem with reading data in fortran 90. my programs try to read a txt file that only contains one number in it but if the txt file is empty it stops. i want to make it continue what should i do?
 
Physics news on Phys.org
Look up the ERROR= option for the READ statement.
 
Even better, look up the END= option.

ERROR= might pick up any type of error, not just that the file doesn't contain enough data.