⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdosfile.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 5 页
字号:
not require file extensions as in the FAT file system.
However, many applications still use the period to denote file
extensions.
.np
The HPFS preserves case in file names only in directory listings but
ignores case in file searches and other system operations.
For example, a directory cannot have more than one file whose names
differ only in case.
.*
.beglevel
.*
.section Special OS/2 Device Names
.*
.np
.ix 'device names'
The OS/2 operating system has reserved certain file names for
character devices.
These special device names are:
.ix 'CLOCK$'
.ix 'COM1'
.ix 'COM2'
.ix 'COM3'
.ix 'COM4'
.ix 'CON'
.ix 'KBD$'
.ix 'LPT1'
.ix 'LPT2'
.ix 'LPT3'
.ix 'MOUSE$'
.ix 'NUL'
.ix 'POINTER$'
.ix 'PRN'
.ix 'SCREEN$'
.ix 'device' 'CLOCK$'
.ix 'device' 'COM1'
.ix 'device' 'COM2'
.ix 'device' 'COM3'
.ix 'device' 'COM4'
.ix 'device' 'CON'
.ix 'device' 'KBD$'
.ix 'device' 'LPT1'
.ix 'device' 'LPT2'
.ix 'device' 'LPT3'
.ix 'device' 'MOUSE$'
.ix 'device' 'NUL'
.ix 'device' 'POINTER$'
.ix 'device' 'PRN'
.ix 'device' 'SCREEN$'
.millust begin
CLOCK$          Clock
COM1            First serial port
COM2            Second serial port
COM3            Third serial port
COM4            Fourth serial port
CON             Console keyboard and screen
KBD$            Keyboard
LPT1            First parallel printer
LPT2            Second parallel printer
LPT3            Third parallel printer
MOUSE$          Mouse
NUL             Nonexistent (dummy) device
POINTER$        Pointer draw device (mouse screen support)
PRN             The default printer, usually LPT1
SCREEN$         Screen
.millust end
.pc
When using one of these special device names, no other part of the
file designation should be specified.
.*
.section Examples of HPFS File Specifications
.*
.np
The following are some examples of valid file specifications.
.autonote
.note
The following file designation refers to a file in the current
directory of the default disk.
.code begin
OPEN( UNIT=1, FILE='DATA.FIL', ... )
.code end
.note
The following file designation refers to a print file in the current
directory of drive :FNAME.&dr3.:eFNAME..
ASA carriage control characters will be converted to the appropriate
ASCII control codes.
.code begin
OPEN( UNIT=2, FILE=':FNAME.&dr3.report&lst.:eFNAME.',
      CARRIAGECONTROL='YES', ... )
.code end
.note
The file specification below indicates that the file is to have
fixed format records of length 80.
.code begin
OPEN( UNIT=3, FILE=':FNAME.final.tst:eFNAME.',
      RECL=80, RECORDTYPE='FIXED', ... )
.code end
.note
The file specification below indicates that the file is to have
variable format records of maximum length 145.
.code begin
OPEN( UNIT=4, FILE=':FNAME.term.rpt:eFNAME.',
      RECL=145, RECORDTYPE='VARIABLE', ... )
.code end
.note
The file designation below indicates that the file resides in the
:FNAME.records:eFNAME. directory of drive :FNAME.&dr2.:eFNAME..
.code begin
OPEN( UNIT=5, FILE=':FNAME.&dr2.&pc.records&pc.customers.dat:eFNAME.', ... )
.code end
.pc
Note that the trailing "S" in the file name is not ignored as is the case in
a FAT file system.
.note
The file designation below refers to the second serial port.
.code begin
OPEN( UNIT=6, FILE=':FNAME.com2:eFNAME.', ... )
.code end
.note
The file designation below refers to a second parallel printer.
.code begin
OPEN( UNIT=7, FILE=':FNAME.lpt2:eFNAME.', ... )
.code end
.endnote
.*
.endlevel
.*
.section Establishing Connections Between Units and Files
.*
.np
.ix 'file connection'
.ix 'unit connection'
Using &cmpname, FORTRAN unit numbers may range from 0 to 999.
Input/output statements such as
.kw READ
and
.kw WRITE
refer to files by a unit number.
All input/output statements except
.kw OPEN,
.kw CLOSE,
and
.kw INQUIRE
must refer to a unit that is connected to a file.
The &cmpname run-time system automatically establishes the connection
of a unit to a file if no connection previously existed.
.ix 'preconnection'
Any connection between a unit and a file that is established before
execution begins is called a preconnection.
.np
.ix 'unit *'
The &cmpname run-time system defines a preconnection of the unit
designated by "*" to the standard input and output devices
(by this we generally mean the keyboard and screen of the personal
computer but input/output can be redirected from/to a file using the
standard input/output redirectors "<" and ">" on the command line).
This preconnection cannot be altered in any way.
Unit "*" is explicitly or implicitly referred to by the following
input statements:
.millust begin
READ, ...
READ *, ...
READ format-spec, ...
READ(*,...) ...
READ(UNIT=*,...) ...
.millust end
.np
Unit "*" is explicitly or implicitly referred to by the following
output statements:
.millust begin
PRINT, ...
PRINT *, ...
PRINT format-spec, ...
WRITE(*,...) ...
WRITE(UNIT=*,...) ...
.millust end
.np
.ix 'unit 5'
The &cmpname run-time system also defines a preconnection of unit 5 to
the standard input device (by this we generally mean the keyboard of
the personal computer but input can be redirected from a file using
the standard input redirector "<" on the command line).
.np
.ix 'unit 6'
The &cmpname run-time system also defines a preconnection of unit 6 to
the standard output device (by this we generally mean the screen of
the personal computer but output can be redirected to a file using
the standard output redirector ">" on the command line).
.np
.ix 'file name' 'default'
.ix 'defaults' 'file name'
For all other allowable units, a default preconnection between unit
number "nnn" and the file
.fi FORnnn
is assumed when no connection between a unit and a file has been
established.
.us nnn
is a three-digit FORTRAN unit number.
Unit 0 is "000", unit 1 is "001", unit 2 is "002", and so on.
There is no file extension in this case.
In other words, a default file name is constructed for any unit number
for which no other connection has been established.
Input/output statements of the following forms refer to these units.
.millust begin
CLOSE(nnn,...)           OPEN(nnn,...)
CLOSE(UNIT=nnn,...)      OPEN(UNIT=nnn,...)
BACKSPACE nnn            READ(nnn,...)
BACKSPACE(nnn)           READ(UNIT=nnn,...)
BACKSPACE(UNIT=nnn)      REWIND nnn
ENDFILE nnn              REWIND(nnn)
ENDFILE(nnn)             REWIND(UNIT=nnn)
ENDFILE(UNIT=nnn)        WRITE(nnn,...) ...
INQUIRE(nnn,...)         WRITE(UNIT=nnn,...) ...
INQUIRE(UNIT=nnn,...)
.millust end
.np
Of course, it is unlikely that one would be satisfied with using such
undistinguished file names such as :FNAME.for000:eFNAME.,
:FNAME.for001:eFNAME., and so on.
Therefore, the &cmpname run-time system provides additional ways of
establishing a preconnection between a FORTRAN
.kw UNIT
and a file.
.np
The &cmpname run-time system supports the use of the "SET" command to
establish a connection between a unit and a file.
.ix 'SET command'
.ix 'environment variable'
The "SET" command is used to create, modify and remove "Environment
Variables".
The "SET" command must be issued before running a program.
The format for a preconnection using the "SET" command is:
.millust begin
SET unit=file_spec
.millust end
.synote
.note unit
is a FORTRAN unit number in the range 0 to 999.
.np
If this form of the "SET" command is used then FORTRAN unit number
.sy unit
is preconnected to the specified file.
FORTRAN input/output statements which refer to the unit number will
access the records in the specified file.
.note file_spec
is the file specification of the preconnected file.
.endnote
.np
Here are some sample "SET" commands.
.exam begin
C>set 1=input.dat
C>set 2=output.dat
C>set 3=&dr4.&pc.database&pc.customer.fil
.exam end
.pc
The above example establishes the following preconnections:
.autonote
.note
Between unit 1 and the file :FNAME.input.dat:eFNAME. which resides (or will
reside) in the current directory.
.note
Between unit 2 and the file :FNAME.output.dat:eFNAME. which resides (or will
reside) in the current directory.
.note
Between unit 3 and the file :FNAME.&dr4.&pc.database&pc.customer.fil:eFNAME.
which resides (or will reside) in another disk and directory.
.endnote
.np
Any FORTRAN input/output statements which refer to units 1, 2 or 3
will act upon one of these 3 data files.
.autonote Notes:
.note
The "SET" command must be issued before running the program.
.note
No spaces should be placed before or after the "=" in the "SET"
command.
The following two examples are quite distinct
from each other:
.exam begin
C>set 55=testbed.dat
C>set 55 = testbed.dat
.exam end
.pc
To verify this, simply enter the two commands and then enter the "SET"
command again with no arguments.
The current environment strings will be displayed.
You should find two entries, one for "55" and one for "55~b".
.note
Since the number in front of the "=" is simply a character string, you
should not specify any leading zeroes either.
.exam begin
C>set 01=input.dat
C>set 1=input.dat
.exam end
.pc
In this case, we again have two distinct environment variables.
The variable "01" will be ignored by the &cmpname run-time system.
.note
An environment variable will remain in effect until you explicitly
remove it or you turn off the personal computer.
To discontinue the preconnection between a unit number and a file, you
must issue a "SET" command of the following form.
.millust begin
&prompt.set <unit>=
.millust end
In the above command,
.mono <unit>
is the unit number for which the preconnection is to be discontinued.
.pc
By omitting the character string after the "=",
the environment variable will be removed.
For example, to remove the environment variable "01" from the list,
reenter the "SET" command specifying everything up to and including
the "=" character.
.exam begin
C>set 01=
.exam end
.note
Any time you wish to see the current list of environment strings,
simply enter the "SET" command with no arguments.
.exam begin
C>set
PROMPT=$d $t $p$_$n$g
COMSPEC=d:\dos\command.com
PATH=G:\;E:\CMDS;C:&pathnamup\BIN;D:\DOS;D:\BIN
&libvarup.=c:&pathnam.&libdir16.\dos
1=input.dat
2=output.dat
3=&dr4.&pc.database&pc.customer.fil
.exam end
.note
An alternative to preconnecting files is provided by the FORTRAN
.kw OPEN
statement which allows files to be connected at execution time.
.note
.ix 'preconnection'
The preconnection of units 5 and 6 may be overridden using
preconnection specifications or the FORTRAN
.kw OPEN
statement.
.ix 'connection precedence'
The precedence of a connection between a unit number and a file
is as follows:
.begnote
:DTHD.Precedence:
:DDHD.User option:
.note Lowest
Preconnection Specifications
.note Highest
OPEN statement
.endnote
.np
In other words, the
.kw OPEN
statement overrides a preconnection.
.endnote
.*
.section A Preconnection Tutorial
.*
.np
.ix 'preconnecting files'
In this section, we will look at some examples of how to establish the
link between a file and a FORTRAN unit.
.np
.bd Exhibit 1:
.np
Consider the following example which reads pairs of numbers from a
file and writes out the numbers and their sum.
.millust begin
* File ':FNAME.iodemo.for:eFNAME.'
10    READ( 1, *, END=99 ) X1, X2
      WRITE( 6, 20 ) X1, X2, X1 + X2
      GO TO 10
20    FORMAT( 3F6.2 )
99    END
.millust end
.pc
The FORTRAN
.kw READ
statement will read records from a file connected to unit 1.
The FORTRAN
.kw WRITE
statement will write records to a file connected to unit 6.
As we described in the previous section, unit 6 is preconnected by the
&cmpname run-time system to the screen.
.np
What file will be read when the
.kw READ
statement refers to unit 1?
By default, we know that it will read a file called :FNAME.for001:eFNAME..
However, suppose the data was actually stored in the file called
:FNAME.numbers.dat:eFNAME..
We can direct the program to read the data in this file by using a
"SET" command before running the program.
.exam begin
C>set 1=numbers.dat
C>iodemo
  1.40  2.50  3.90
  3.90  8.70 12.60
  1.10  9.90 11.00

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -