Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cool Line Input feature
#1
Well, okay, this might also be one of those situations where I'm the only guy who didn't get the memo.

If we create a text file with multiple lines, each line ending with a <return>, and we use Line Input to read each line as one long string, the Line Input command only reads the top line in the file.

Okay, I thought, I can deal with that. I can always copy-paste the other lines to the top, to input each line.

No need!

All you have to do is go back to that Line Input statement, and it will automatically read the next line down, in the text file. How cool is that?

Code: (Select All)
Dim Shared a$
Open "..\Textfile_with_many_lines_each_ending_with_carriage_return.ini" For Input As #1
1 Line Input #1, a$
Call sub_to_do_whatever
Print
Input "More sentences (y/n)"; cont$
If cont$ = "y" Then
    Print
    GoTo 1
End If
Close
End

Sub sub_to_do_whatever
    Print a$
End Sub

I add one line at the bottom of the text file, which says "stop," to end the process. For this demo program, the subroutine only prints the line input from the text file.
Reply


Messages In This Thread
Cool Line Input feature - by bert22306 - 09-13-2022, 02:18 AM
RE: Cool Line Input feature - by Pete - 09-13-2022, 02:47 AM
RE: Cool Line Input feature - by JRace - 09-13-2022, 05:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Feature Request: Limit Scope of a "Find" and "Change" hanness 5 716 06-21-2025, 11:21 PM
Last Post: SMcNeill
  Program line Chris 10 1,277 04-06-2025, 10:28 PM
Last Post: TempodiBasic
  Mix mode input of a binary open file Question! doppler 5 1,468 11-28-2024, 03:06 PM
Last Post: Petr
  I need input on a possible bug in v3.5.0 TerryRitchie 50 8,349 05-22-2024, 07:03 PM
Last Post: TerryRitchie
  Input routine dano 9 1,521 05-21-2024, 03:50 AM
Last Post: grymmjack

Forum Jump:


Users browsing this thread: