readLine()->byte[256]
Reads a string (without ‘\n’) from the previously opened file.
open(C_READ, "my_file.txt")
while not eof():
print(readLine())
close()
Note: A maximum of 255 characters can be read per call.
writeLine(line:byte[])
Writes a string + ‘\n’ to the previously opened file.
open(C_WRITE, "my_file.txt")
writeLine("Hello World!")
close()
fileExists(path:byte[])->bool
Returns true if the file exists in the file system.
eof()->int
A value greater than 0 (true) is returned if the end of file indicator was set. Otherwise 0 (false) is returned.
renameFile(path:byte[], newPath:byte[])
Renames the file defined with “path” to “newPath”.
renameFile("my_file.txt", "my_new_file.txt")
deleteFile(path:byte[])
Deletes the file defined with “path”.
deleteFile("my_file.txt")
getFileSize(path:byte[])->long
Returns the size of the file defined with “path” in number of bytes.
size = getFileSize("my_file.txt")
close()
Closes the previously opened file.
close()
readFloat()->float
Reads a float value from the previously opened file.
open(C_READ, "my_file.txt")
val = readFloat()
close()
readLong()->long
Reads a long value from the previously opened file.
open(C_READ, "my_file.txt")
val = readLong()
close()
readInt()->int
Reads an int value from the previously opened file.
open(C_READ, "my_file.txt")
val = readInt()
close()
readByte()->byte
Reads a byte value from the previously opened file.
open(C_READ, "my_file.txt")
val = readByte()
close()
read()->byte
Reads a single character from the previously opened file.
open(C_READ, "my_file.txt")
text:byte[13] # to hold "Hello World!"
for i in 13:
text[i] = read()
close()
writeFloat(val:float)
Writes a float value to the previously opened file.
open(C_WRITE, "my_file.txt")
writeFloat(123.456)
writeFloat(-123.456)
close()
writeLong(val:long)
Writes a long value to the previously opened file.
open(C_WRITE, "my_file.txt")
writeLong(2147483647)
writeLong(-2147483647)
close()
writeInt(val:int)
Writes an int value to the previously opened file.
open(C_WRITE, "my_file.txt")
writeInt(32767)
writeInt(-32768)
close()
writeByte(val:byte)
Writes a byte value to the previously opened file.
open(C_WRITE, "my_file.txt")
writeByte(255)
close()
write(val:byte)
Writes a single character to the previously opened file.
open(C_WRITE, "my_file.txt")
text = "Hello World!"
for c in text:
write(c)
close()
open(type:byte, path:byte[])
Opens the file defined with “path” for reading, writing or appending.
open(C_READ, "my_file.txt")
open(C_WRITE, "my_file.txt")
open(C_APPEND, "my_file.txt")