Page 1 of 1

How read the text lines from txt file?

Posted: Wed Mar 12, 2014 3:22 pm
by Juan Carlos
I have this little question but a big problem for me, How read text lines from txt file? I open the file and insert as items every text line?

Re: How read the text lines from txt file?

Posted: Wed Mar 12, 2014 10:52 pm
by PEB
Well, you could use ReadLine().
You could also process your text file using FileToString() and then SplitStr() with "\n" as your token$.

Re: How read the text lines from txt file?

Posted: Wed Mar 19, 2014 11:40 pm
by Juan Carlos
Any easy and single example to open the txt file?

Re: How read the text lines from txt file?

Posted: Thu Mar 20, 2014 7:51 am
by PEB
The Hollywood documentation has a lot of good example code, such as this:

Code: Select all

OpenFile(1, "S:Startup-Sequence")
While Not Eof(1) Do NPrint(ReadLine(1))
CloseFile(1)

Re: How read the text lines from txt file?

Posted: Sat Mar 22, 2014 2:17 pm
by Juan Carlos
PEB wrote:The Hollywood documentation has a lot of good example code, such as this:

Code: Select all

OpenFile(1, "S:Startup-Sequence")
While Not Eof(1) Do NPrint(ReadLine(1))
CloseFile(1)
Thanks although I want read every line and put inside of variable to use every line of text, and I don't know as to do this, read the end every line and put in one Text$ variable and read the end of txt file.

Re: How read the text lines from txt file?

Posted: Mon Mar 24, 2014 7:02 am
by PEB
I might not be understanding what you want to do, but I think you want to put each line into a table. If that is the case, then you can modify the sample code to something like this:

Code: Select all

TempTable$={}
OpenFile(1, "S:Startup-Sequence")
While Not Eof(1) Do InsertItem(TempTable$, ReadLine(1))
CloseFile(1)

Re: How read the text lines from txt file?

Posted: Tue Mar 25, 2014 3:18 pm
by Juan Carlos
PEB wrote:I might not be understanding what you want to do, but I think you want to put each line into a table. If that is the case, then you can modify the sample code to something like this:

Code: Select all

TempTable$={}
OpenFile(1, "S:Startup-Sequence")
While Not Eof(1) Do InsertItem(TempTable$, ReadLine(1))
CloseFile(1)
Thanks, I need this, because I have problems with the translations for V.A.M.P. some special letters with editors and with the compiled change them, and the alternative is open the translation file, and get line to line and to put in the text message variable.