Hi all,
I'm early approaching to PLC programming, and I'm trying to do a simple task like to read a file.
I used the classic example with SysFile library and the program work correctly, so I can read all bytes of the file, convert them to string and parse all the stuff. Ok.
This work only if the file's size is lower then 1000 bytes, because the maximum size of the array used to contain the bytes of the file can be 1000, in particular I have an ARRAY[0..MAX_BUFFER] OF BYTE, where MAX_BUFFER is 999.
Obviously, I tried to increase the value of MAX_BUFFER but the array's size keep to be 1000. This means that the array can have maximum size 1000.
So I thought to read, every PLC scan, chunk of the file and not the whole file. But the SysFileRead don't give me the possibility to start to read from a different byte. Seems that the function starts always from the first byte. So I have not the possibility to scroll the file.
The two parameters controllable are pbyBuffer (where I put the data readed) and ulSize (how many data I want to read). There is no an index or something like that.
Someone can help me?
Thanks a lot!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I'm early approaching to PLC programming, and I'm trying to do a simple task like to read a file.
I used the classic example with SysFile library and the program work correctly, so I can read all bytes of the file, convert them to string and parse all the stuff. Ok.
This work only if the file's size is lower then 1000 bytes, because the maximum size of the array used to contain the bytes of the file can be 1000, in particular I have an ARRAY[0..MAX_BUFFER] OF BYTE, where MAX_BUFFER is 999.
Obviously, I tried to increase the value of MAX_BUFFER but the array's size keep to be 1000. This means that the array can have maximum size 1000.
So I thought to read, every PLC scan, chunk of the file and not the whole file. But the SysFileRead don't give me the possibility to start to read from a different byte. Seems that the function starts always from the first byte. So I have not the possibility to scroll the file.
BytesRead := SysFileRead(hFile:=FileHandle, pbyBuffer:=pFileData, ulSize:=MAX_BUFFER, pResult:=pResult);
The two parameters controllable are pbyBuffer (where I put the data readed) and ulSize (how many data I want to read). There is no an index or something like that.
Someone can help me?
Thanks a lot!
Solved, using this: SysFile.SysFileSetPos
Thanks