April 26, 2024, 08:29:17 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Forum rules
-
please read before posting, it can save you a lot of time.
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
File Object, ReadLine method
« previous
next »
Pages: [
1
]
Print
Author
Topic: File Object, ReadLine method (Read 4186 times)
0 Members and 1 Guest are viewing this topic.
Ennio
Lurker
Karma: 2
Offline
Posts: 40
File Object, ReadLine method
«
on:
January 10, 2012, 10:40:51 AM »
It's not really clear how ReadLine() method works.
It reads "a" line...but how can i read each line of my file? There is an index to pass as a parameter for this method?
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: File Object, ReadLine method
«
Reply #1 on:
January 10, 2012, 06:46:44 PM »
The file is read sequentially. You open the file, ReadLine() will read the first line. Second call to ReadLine() will read the second line etc.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Ennio
Lurker
Karma: 2
Offline
Posts: 40
Re: File Object, ReadLine method
«
Reply #2 on:
January 11, 2012, 09:18:36 AM »
Wow, very nice and simple!
No nextLine, hasLine, blablaLine method
Thankyou!
Logged
Ennio
Lurker
Karma: 2
Offline
Posts: 40
Re: File Object, ReadLine method
«
Reply #3 on:
January 12, 2012, 01:51:52 PM »
Sorry I forgot to ask one more thing about this,
how can i write a while "there is line" {file.ReadLine()} cicle?
Is correct to write something like
(while file.ReadLine())
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: File Object, ReadLine method
«
Reply #4 on:
January 15, 2012, 02:16:20 PM »
You can do something like this:
Code: WME Script
while
(
true
)
{
var
line = file.
ReadLine
(
)
;
if
(
line ==
null
)
break
;
// process line here
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Ennio
Lurker
Karma: 2
Offline
Posts: 40
Re: File Object, ReadLine method
«
Reply #5 on:
January 15, 2012, 05:40:55 PM »
right! Thank you!
Logged
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
File Object, ReadLine method