09-13-2022, 02:18 AM
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?
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.
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.