OpenFileRead

Family: File · 2 forms

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) → integer
2
OpenFileRead(ID integer, szFile string)

Parameters

NameTypeIn forms
szFilestringall
IDinteger2

What each form returns

1OpenFileRead("assets/data.dat")integer
2OpenFileRead(1, "assets/data.dat")nothing

Example · generated

Form 1, the command hands back the id

DO  Print(OpenFileRead("assets/data.dat"))  Sync()LOOP

Form 2, you choose the id yourself

OpenFileRead(1, "assets/data.dat")DO  Sync()LOOP

OpenFileRead 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.

61 commands in File