Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

how to read a text file using codesys..

2007-06-25
2007-06-25
  • bharathreddy - 2007-06-25

    Hi everybody,

    In my project i need to read a text file ,for this purpose i am using SysFileOpen, SysFileRead functions .But when i run the application in simulation mode and checked the output from SysFileOpen block it always showing 0 only.I included necessary library file also (SysLibFile.Lib) .

    can anybody help me in this regard or i need to do anything further...

    any help is appreciated

    Thanks & regards,

    bharath

     
  • Avgur - 2007-06-25

    Hi!

    I think CoDeSys just SIMULATE behaviour of the controller and can't create or read files as well as it can't simulate COM port and work with it. Thus the function SysFileOpen always returns 0.

    my example

    hnd:=SysFileOpen('/data/mylog.txt','r');
    ...
    SysFileRead(hnd,ADR(buffer),bytes_to_read);
    

    It's a good idea to use forum search: the same question on this page

     

Log in to post a comment.