CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sat Dec 15, 2018 10:03 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jun 14, 2018 12:09 pm 
Offline

Joined: Fri Jun 08, 2018 2:59 pm
Posts: 2
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!


Top
   
PostPosted: Thu Jun 14, 2018 2:19 pm 
Offline

Joined: Fri Jun 08, 2018 2:59 pm
Posts: 2
Solved, using this: SysFile.SysFileSetPos

Thanks


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited