![]() Getfil PATH IS: /home/users/auser/subdir/atest.f The program uses the library routines GETENV, LNBLNK, and GETCWD to return the value of the $HOME environment variable, find the last non-blank in the string, and determine the current working directory:ĭemo% f95 -o getfil GetFilNam.f demo% getfil ENTER FILE NAME: The following example ( GetFilNam.f) shows one way to construct an absolute path file name from a typed-in name. Library routines can be used to bring command-line arguments and environment variables into the program as character variables for use as file names in OPEN statements. Also, the specifier may be a character constant, variable, or character expression. The FILE= specifier on an OPEN statement may specify a simple file name ( FILE='myfile.out') or a file name preceded by an absolute or relative directory path ( FILE='./Amber/Qproj/myfile.out'). This file can be pre-existing or created by the program. The OPEN statement's FILE= specifier establishes the association of a logical unit to a named, physical file at runtime. ![]() Also, certain preconnected units are automatically associated with specific files at the start of program execution. The asterisk stands for standard input file when it appears in a READ statement it stands for standard output file when it appears in a WRITE or PRINT statement.Ī Fortran logical unit can be associated with a specific, named file through the OPEN statement. The character * can appear as a logical unit identifier. Logical units are identified in an I/O statement by a logical unit number, a nonnegative integer from 0 to the maximum 4-byte integer value (2,147,483,647). ![]() 2.1 Accessing Files From Within Fortran Programsĭata is transferred between the program and devices or files through a Fortran logical unit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |