ReadFileBytes Procedure
Reads the contents of a file as a list of bytes.
Each byte in the file is a number from 0-255 in the list.
Use
WriteFileBytes to write a list of bytes to a file.
Declaration
function ReadFileBytes(filePath as String) as List of Number
Parameters
- filePath as String — Path and filename.
Return value
List of Number — The contents of the file, one element per byte.
Possible error codes
- ERR_ACCESS_DENIED
- ERR_FILE_NOT_FOUND
- ERR_IO_FAILURE
- ERR_PATH_IS_DIRECTORY
- ERR_PATH_TOO_LONG
Example
Code
WriteFileText "myfile.dat", "ABC"
dim x = ReadFileBytes("myfile.dat")
print Len(x)
print x(0)
print x(1)
print x(2)
Output