You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old September 1st, 2015, 11:31 AM   #1
EnterDownload
Member
United States

EnterDownload is offline
 
Join Date: May 2015
Location: NY
Posts: 12
Codesys :How do i read all lines of text from a text file?

Hello
I am using codesys v3.5.
I am using the CAA File library to read/write lines of text from a file stored on my Festo PLC.
I have found out how to read 1 line of text from my text file.
But how do I read the next set of lines within the text file separately until the end of file is reached?

Example:

Read line 1
Read line 2
Read line 3
Read line 4
End of File

I know I would normally put the code in a "Repeat" loop until end of file ...but what should the code look like to read all lines until all lines have been read or End of File?

thanks

Jay
  Reply With Quote
Old September 1st, 2015, 01:11 PM   #2
EnterDownload
Member
United States

EnterDownload is offline
 
Join Date: May 2015
Location: NY
Posts: 12
Maybe I need more explanation?

Im trying to read all lines from a text file stored on my PLC, 1 by 1

Something like the code below. The problem is this code below always reads the same 1st line...how do I change to the code to read the next lines in my file?..e.g. line 2, line 3, ect

Repeat

FileRead(xExecute:= TRUE, hFile:= hfile, pBuffer:= ADR(sReadLine), szBuffer:= SIZEOF(sReadLine));

Until xEOF

End_Repeat
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Converting .mer file to .apa Lost all the text KA24DE LIVE PLC Questions And Answers 1 September 14th, 2007 01:07 PM
WinCC text file logging Doug_Adam LIVE PLC Questions And Answers 4 July 6th, 2006 01:58 AM
How to Read AB Long-words (L File)? PLCSam LIVE PLC Questions And Answers 4 October 16th, 2003 09:40 PM
Data Tables bosshen LIVE PLC Questions And Answers 5 April 28th, 2003 06:30 PM
RS logix - error on file decompression and read. help me! Tom sem Jerry LIVE PLC Questions And Answers 4 March 14th, 2003 08:13 PM


All times are GMT -5. The time now is 11:29 PM.


.