| Thread Closed |
Fortran: help with I/O in Direct Access and Seq. access |
Share Thread | Thread Tools |
| Mar19-10, 03:23 PM | #1 |
|
|
Fortran: help with I/O in Direct Access and Seq. access
Hello,
I am implementing simple check-pointing in an application so that the history is saved to a file and upon restart the data is read from this file. -> The history file contains an array of real*8 numbers and precision is very important in the program. I first implemented this using direct access unformatted file and it worked fine. Basically the default free-format specifiers used by fortran had the same precision while writing and reading the data. Code:
C Write
open(unit,file='hist.dat',
+ access='DIRECT',RECL=recordlength)
write(unit,REC=NF),(X(I),I=1,N),F,NF
close(unit)
C READ
open(unit,file='hist.dat',status='old',
+ ACCESS='DIRECT',RECL=recordlength)
read(unit,REC=NF),
+ (X(i),i=1,N),F,NF
close(unit)
Code:
C write
open(unit,file='hist.dat',
+ access='APPEND')
write(unit,*) (X(I),I=1,N),F,NF
close(unit)
C read
open(unit,file='hist.dat')
read(unit,*)
+ (X(i),i=1,N),F,NF
close(unit)
How can make the seq. I/O format specifiers exactly the same as the direct I/O ? Can someone point me in the right direction as I am clueless at this point. Thank You. Nikhil |
| Thread Closed |
| Thread Tools | |
Similar Threads for: Fortran: help with I/O in Direct Access and Seq. access
|
||||
| Thread | Forum | Replies | ||
| Journal Access, etc. | Academic Guidance | 1 | ||
| MS Access | Computers | 2 | ||
| TechRepublic's Quick Reference: Microsoft Access Pak helps you understand Access features | Computing & Technology | 0 | ||
| Access PF | General Discussion | 10 | ||