From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

Opens an existing file or creates new one (in “write” mode) with the name given in the string expression.

Filename should not exceed  8 characters and one of next extensions:

PRG , DAT , TSK , CMP for files ,open at Flash disk

or  REC, TXT , which  open at RAM disk.

Open text file for read, write or append to the existing file according to mode flag.

"r"  - open text file for reading

"w" - truncate to zero length or create text file for writing

"a" - append; open or create text file for writing at end-of-file

Use APPEND to add new lines at the end of the original contents of the file.

Use WRITE to overwrite the previous file or for the new one creation .


Open<file name>  MODE= <mode flag>  As #<DeviceHandle>


Versions and higher


< file name>: String
<mode flag>: String
<DeviceHandle>: Long


< file name>:  not more, then 12 characters (8 char. name + dot + 3 char. extension)
<mode flag>:         "r" – read mode

"w" – write mode

"a" -  append mode

                             <DeviceHandle>: 1 to 255


Task or Terminal


The defined file should exist on DiskOnChip for read and append modes


Open "File1.PRG" Mode="w" as  #1


Common shared FileNameStr as string = "File1.PRG"

Common shared ModeStr as string = "w"

Open FileNameStr Mode= ModeStr as  #1

See Also