Datalogger Help?
G3ek4Evur
Posts: 10
My question is based off of the following object: http://obex.parallax.com/objects/237/. On the "readFromFile" method, what does offset mean?
Comments
PUB readFromFile(buf,num,offset): YesNo | c
'/**
' * Read bytes from file opened for read.
' *
' * @param buf Array to hold the read bytes.
' * @param num Number of bytes to read. Must not exceed the number of remaining bytes in the file.
' * Call method filesize prior to opening the file and adjust num so it will not read beyond EOF.
' * @param offset Startindex in buf to write bytes to.
' * @return True if command succesful.
' */
writeByte("R")
writeByte("D")
writeByte("F")
writeByte(" ")
writeByte(num.byte[3])
writeByte(num.byte[2])
writeByte(num.byte[1])
writeByte(num.byte[0])
writeByte(CR)
repeat while num > 0
c := readByte
if c <> -1
byte[buf+offset] := c
offset++
num--
return receivePromptOrError(1000)
My question before was what is offset?
usb.filesize(string("song.mp3")) 'size of the song.
usb.readFromFile(2_035_712, 2_033_664, 0)'size of the song in bytes.