News:

  • October 12, 2024, 04:00:38 PM

Login with username, password and session length

Author Topic: reading from a file by line  (Read 1250 times)

LennyG

  • Newbie
  • *
  • Posts: 2
reading from a file by line
« on: June 09, 2024, 02:14:13 AM »
I have a text file with different text strings on each line and I would like to load them into the a string using the file read command by line. It seems like that is difficult to have that line in the line in the file be a variable. Is there something I'm Missing?
Example: load the "X" line of 64 characters in SS1, where X changes from time to time to get different  text strings.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6040
  • Yes Pinky, Do-more will control the world!
Re: reading from a file by line
« Reply #1 on: June 09, 2024, 02:57:36 PM »
I have a text file with different text strings on each line and I would like to load them into the a string using the file read command by line. It seems like that is difficult to have that line in the line in the file be a variable. Is there something I'm Missing?
Example: load the "X" line of 64 characters in SS1, where X changes from time to time to get different  text strings.

If you are talking the line # being a variable, then no, there is instruction to do that. The file must be must be parsed line by line, particularly if the line length varies. If the line lengths were all the same, then it's simple math and a FILESEEK instruction.

I would add a program block that would open the file and parse to the line you need. You'd just set the target line when you run the program. It would be quite straightforward using stages.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO