PDA

View Full Version : Splitting a .txt file into lines


Raeiphon
05-03-2006, 11:33 AM
Basically, what I want to do, is to open a file (it's a .pls file but can be read by notepad) and split each line of it into an array, so I can use that array. I'm totally stumped on where to with this, what should I do? Could somebody help me?

Angel_Light
05-03-2006, 02:35 PM
This might help you if your trying to stream radio's in graal (http://forums.graalonline.com/forums/showthread.php?t=64166)

Also, you can open it with wordpad

napo_p2p
05-03-2006, 08:52 PM
This might help you if your trying to stream radio's in graal (http://forums.graalonline.com/forums/showthread.php?t=64166)

Yes, check that if you are wondering about radio streams (because it seems like you are).

But, there is a way to load the lines of a file into an array (I am not sure if it works with .pls, but if it opens in notepad it probably will).

Try something like:
this.foo.loadlines("path/to/file.pls");

And tada! 'this.foo' will be an array where every member represents one line of the file.

ApothiX
05-03-2006, 09:59 PM
file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.

Skyld
05-03-2006, 10:00 PM
file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.
I don't think Graal's reading functions are binary-safe! You may explode Graal.

napo_p2p
05-04-2006, 12:53 AM
file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.

I don't think loadlines() works on .graal files and graphics.

ApothiX
05-04-2006, 12:57 AM
I don't think Graal's reading functions are binary-safe! You may explode Graal.
That's what I meant by "just wouldn't get the data you'd think you would" :p

I don't think loadlines() works on .graal files and graphics.
File extension doesn't matter on them. It may have something to do with the folder config if it can't load those files for some reason, but all .graal files are anyway, are text files with certain things on certain lines.

Maniaman
05-04-2006, 05:35 AM
You can load pretty much any file with loadlines. I have used it many time to aod the contents of .nw files to add level links and stuff.

Raeiphon
05-04-2006, 10:08 AM
Yeah, it works. I'm scripting a play class that'll open .aac files, as 24k is much more friendly for the people on 126k who lag when 96k .pls starts playing. Thanks for the help.

Raeiphon
06-30-2006, 09:46 AM
One last thing, does loadlines load from a url if I specify that as the file, or do I need to have it saved as a var through requestURL for it to work?

Novo
06-30-2006, 11:42 AM
Rephrase your question. It's... Confusing.

Admins
06-30-2006, 02:14 PM
There was an example here: http://forums.graalonline.com/forums/showthread.php?t=64166
It is loading a playlist, but you can also load other files, just modify the onData function (and remove onTimeout and onMusicDataReceived).