
Hitachi Embedded Workshop User Manual
261
FOPEN
5
H'05, H’15, H’25
Opens a file
The [FOPEN] opens a file and returns the file number. After this processing, the returned file number must be
used to input, output, or close files. A maximum of 256 files can be open at the same time.
Parameter Block
Function code: H'15 (24-bit address), H'25 (32-bit address)
Function code: H'05 (16-bit address)
Start address of file neme
+0
+2
+4
+6
One byte
Return value
Open mode
File number
Unused
One byte
Start address of file neme
+0
+2
+4
One byte
Return value
Open mode
File number
Unused
One byte
Parameters
Return value (output)
0: Normal completion
–1: Error
File number (output)
The number to be used in all file accesses after opening.
Open mode (input)
H'00: "r"
H'01: "w"
H'02: "a"
H'03: "r+"
H'04: "w+"
H'05: "a+"
H'10: "rb"
H'11: "wb"
H'12: "ab"
H'13: "r+b"
H'14: "w+b"
H'15: "a+b"
These modes are interpreted as follows.
"r": Open for reading.
"w": Open an empty file for writing.
"a": Open for appending (write starting at the end of the file).
"r+": Open for reading and writing.
"w+": Open an empty file for reading and writing.
"a+" : Open for reading and appending.
"b" : Open in binary mode.
Start address of file name (input)
The start address of the area for storing the file name.