To check if a file exists in fortran 90, there is a fortran function called INQUIRE. Example of a fortran code (called here "test.f90"):
program testlogical :: file_existsINQUIRE(FILE="inputs.txt", EXIST=file_exists)write(6,*) file_existsend
Compilation
gfortran test.f90 -o testtest
will return:
F if the file inputs.txt does not existT if the file inputs.txt exists
References
| Links | Site |
|---|---|
| Single command to open a file or create it and the append data | stackoverflow |
| Check_that_file_exists Fortran | rosettacode |
| INQUIRE Fortran 77 | Oracle Doc |
