OpenToRead

Description

Opens a file stored on the local filesystem for reading into the specified ID. All platforms are restricted to a single folder for reading and writing so file paths must be relative, not absolute. This command will check the special write folder first, and if it cannot locate the file it will check the media folder, so you may load images, sounds, and other bundled media files using this command.

To read a file outside the normal read or write folders you can use "raw:" followed by an absolute path for the current platform, for example "raw:C:\MyFolder\MyFile.txt" on Windows or "raw:/sdcard/Documents/MyFile.txt" on Android.

On Raspberry Pi you can use this command to open a GPIO pin for reading by using the filename "gpio:" followed by the GPIO pin number, for example OpenToRead(1, "gpio:4"), this is case sensitive. You can then use ReadByte to read from the pin and CloseFile to close the pin.

Definition

OpenToRead( ID, szFile )

integer OpenToRead( szFile )

Parameters