ROpen Statement
Opens a file for reading.
Syntax
ROpen fileName As #fileNumber
.
.
Close #fileNumber
Parameters
- fileName
- Specify a string containing the path and file name. If only file name is specified, a file in the current directory is specified. See ChDisk for the details.
- fileNumber
- Specify an integer value from 30 to 63 or an expression.
Description
Opens the specified fileName for reading and identifies it by the specified fileNumber. This statement is used to open and read data from the specified file.
Notes
- PC disk only
- A network path is available.
The fileNumber identifies the file as long as the file is open and until it is closed the same file number cannot be used to the other files. The fileNumber is used for the file operation commands (Input#, Read, Seek, Eof, Close)
Close statement closes the file and releases the file number.
It is recommended that you use the FreeFile function to obtain the file number so that more than one task are not using the same number.
See Also
Close, Input #, AOpen, BOpen, UOpen, WOpen, FreeFile
ROpen Statement Example
Integer fileNum, i, j
fileNum = FreeFile
WOpen "TEST.DAT" As #fileNum
For i = 0 To 100
Print #fileNum, i
Next i
Close #fileNum
fileNum = FreeFile
ROpen "TEST.DAT" As #fileNum
For i = 0 to 100
Input #fileNum, j
Print "data = ", j
Next i
Close #fileNum