Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!munnari.oz.au!uhccux!tholen From: tholen@uhccux.uhcc.Hawaii.Edu (David Tholen) Newsgroups: comp.lang.fortran Subject: Re: File handling in Fortran 77 Message-ID: <9665@uhccux.uhcc.Hawaii.Edu> Date: 3 Oct 90 08:40:31 GMT References: <28454@pasteur.Berkeley.EDU> Organization: University of Hawaii Lines: 17 In article <28454@pasteur.Berkeley.EDU>, ndeng@euler.Berkeley.EDU writes: > Correct me if I am wrong. But how could one CONNECT to a file before OPEN it? Simple. OPEN it twice without CLOSEing it in between. The file will be connected before the second OPEN. Many systems preconnect some or all units. For example, many compilers do not require you to OPEN the keyboard to accept input or OPEN the screen (or printer) to print output. UNIX systems preconnect logical units 0, 5, and 6, to standard error, standard input, and standard output, respectively. Some UNIX FORTRANS preconnect all other units to files with names 'fort.N', where N corresponds to the logical unit number. Thus if you WRITE to a logical unit number that hasn't been explicitly OPENed, the output will go to the file 'fort.N'. Any file that has been preconnected will be connected at the time of an explicit OPEN statement. So why would somebody want to OPEN a file that is already OPENed? Simply to change the connection properties, such as BLANK='NULL' to BLANK='ZERO'.