| Thread Closed |
Fortran 90 Question |
Share Thread | Thread Tools |
| Oct22-08, 03:20 AM | #1 |
|
|
Fortran 90 Question
Hi all,
I've recently obtained some code in Fortran 90 that was compiled with gfortran. I am compiling with f90 and one of the called statements is not recognised. I have call flush(1) where 1 is the filename that the code is flushing. Since flush is not a part of f90, is there an alternative statement which will do the same job in f90? Thanks, Natski |
| Oct22-08, 08:20 AM | #2 |
|
Recognitions:
|
Without looking too deeply into whether there is a direct replacement, one method that should achieve the same result would be to close the file and then immediately re-open it.
|
| Oct22-08, 12:04 PM | #3 |
|
|
Hmm, the open command has position='append', so presumably this is why one cannot simply close then open?
|
| Oct22-08, 10:23 PM | #4 |
|
Recognitions:
|
Fortran 90 Question |
| Oct23-08, 06:05 AM | #5 |
|
|
Flush is a C command really, but it seems that there must be a Fortran version of this command, without opening and closing?
|
| Oct24-08, 09:08 AM | #6 |
|
Recognitions:
|
Can you determine (by reading the code) exactly where the current file position is when it's flushed? I mean if it's somewhere convenient like right at the beginning or end then it would be easy enough to just "close/re-open/reposition", but if it's some arbitraty position then yes it would be much better to try and find a replacement for flush.
|
| Oct25-08, 11:22 PM | #7 |
|
|
If the file was opened with the append attribute, closing and reopening it with the same append attribute should get the file pointer to point to the same place, as long as we are dealing with a sequential text file and there are no concurrent processes.
Do a little test to confirm it. Also, some f90 dialects support flush without the unit number, as in flush(). |
| Thread Closed |
| Thread Tools | |
Similar Threads for: Fortran 90 Question
|
||||
| Thread | Forum | Replies | ||
| Fortran Question | Programming & Comp Sci | 19 | ||
| Accessing Fortran Modules within a Fortran library from Fortran | Programming & Comp Sci | 0 | ||
| simple FORTRAN question | Programming & Comp Sci | 2 | ||
| FORTRAN:Simple question | Programming & Comp Sci | 0 | ||
| How many bytes in DIMENSION?? - A Fortran Question | Programming & Comp Sci | 4 | ||