Computer Science Canada Reading files in a folder |
Author: | metachief [ Fri Jun 06, 2008 9:21 am ] |
Post subject: | Reading files in a folder |
I was trying to make a music player a while ago, but gave up because I could not figure out how to read music files from a folder. I know making a music player with turing is a stupid idea, but I'm just experimenting... Anyway if anyone could help me with this it would be great. |
Author: | apomb [ Fri Jun 06, 2008 9:30 am ] | ||
Post subject: | RE:Reading files in a folder | ||
try a little
on for size ![]() EDIT: Relative path instead ... |
Author: | metachief [ Fri Jun 06, 2008 9:46 am ] |
Post subject: | RE:Reading files in a folder |
Thats obvious, but iwas look more for a way to list all of the files in the folder as a list on the music playlist. |
Author: | apomb [ Fri Jun 06, 2008 9:52 am ] |
Post subject: | RE:Reading files in a folder |
ah, then you would simply have an array of filenames read in from a playlist file and that variable would then be substituted in for the file to play. This is problem Solving 101. |
Author: | metachief [ Fri Jun 06, 2008 2:47 pm ] |
Post subject: | RE:Reading files in a folder |
how would i go about reading and storing the names in the folder into the array. that was my question. it's not like a text document where you can use the command open. |
Author: | apomb [ Fri Jun 06, 2008 3:04 pm ] | ||||
Post subject: | RE:Reading files in a folder | ||||
yes it is...
just read each line in, assign each to an array element, and VOILA. then do a
|
Author: | metachief [ Fri Jun 06, 2008 4:21 pm ] |
Post subject: | RE:Reading files in a folder |
But how do i get th elist of files from the folder with turing. Without specifying the file names my self. Same thing as reading the words in a text document except in a folder composed of music files... |
Author: | riveryu [ Fri Jun 06, 2008 4:48 pm ] |
Post subject: | RE:Reading files in a folder |
Use Turing's Dir.Get to determine the filenames and type by their extension, store them in an array. Then play music to them according to user choice. Be sure to have a solid background on the Dir module though. |
Author: | apomb [ Fri Jun 06, 2008 10:14 pm ] |
Post subject: | RE:Reading files in a folder |
Oh ok, i thought you were wanting to create a playlist in a file, using the music file names, then read that list... sorry for the misunderstanding, and yes, the Dir. module would work just as riveryu says. |
Author: | metachief [ Sat Jun 07, 2008 11:39 pm ] |
Post subject: | RE:Reading files in a folder |
Thanks for the help guys. |