What it does
OpenFileRead opens Read on a File object. It takes szFile (a string), and answers an integer. That is the first of 2 forms.
Syntax
1
OpenFileRead(szFile string) → integer2
OpenFileRead(ID integer, szFile string)Parameters
| Name | Type | In forms |
|---|---|---|
| szFile | string | all |
| ID | integer | 2 |
What each form returns
| 1 | OpenFileRead("assets/data.dat") | integer |
| 2 | OpenFileRead(1, "assets/data.dat") | nothing |
Example · generated
Form 1, the command hands back the id
DO Print(OpenFileRead("assets/data.dat")) Sync()LOOPForm 2, you choose the id yourself
OpenFileRead(1, "assets/data.dat")DO Sync()LOOPOpenFileRead is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.