Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Scratchfile

NH_Veldhuijzen
Beginner
506 Views
Dear Forum,

in the following short program, I open a scratch file, write into it, and close it. Contrary to what I found said in the manual, after the program has run, there is still a file "fort.20" in my folder.

program scratch
open (20,form='binary')
write (20) 'helloworld'
close (20)
end program scratch

Yours sincerely,
Niels H. Veldhuijzen
Cito, POK
Arnhem, The Netherlands
niels.veldhuijzen@citogroep.nl
0 Kudos
3 Replies
Steven_L_Intel1
Employee
506 Views
You didn't say STATUS='SCRATCH' in the OPEN.

Steve
0 Kudos
NH_Veldhuijzen
Beginner
506 Views
Dear Steve,

yes, that's right. In the paragraph on the "close" statement in the manual, I read: "Files opened without a filename are called "scratch" files. Scratch files are temporary and are always deleted upon normal program termination; specifying STATUS='KEEP' for scratch files causes a run-time error. " I gathered from this that a scratch file is defined as soon as you open a file without giving it a name. Obviously, I'm wrong here. Indeed, when reading the manual about the "open" statement, and especially about the "file" specifier, I learned that the "scratch" status must be given. Thanks.

Yours sincerely,
Niels H. Veldhuijzen
Cito, Arnhem, The Netherlands
niels.veldhuijzen@citogroep.nl
0 Kudos
Steven_L_Intel1
Employee
506 Views
Ah... The text you quote, from the on-disk Reference Manual, describes the behavior only if you select the PowerStation Compatibility: General option. The Compaq Fortran default is that files opened without an explicit name are assigned a name based on the unit number. I'll have the text corrected. Thanks for pointing it out.

Steve
0 Kudos
Reply