Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Reading files in a folder
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
metachief




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: Fri Jun 06, 2008 9:30 am   Post subject: RE:Reading files in a folder

try a little
Turing:
Music.PlayFile(<Relative Path\Filename>)

on for size Wink
EDIT: Relative path instead ...
metachief




PostPosted: 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.
apomb




PostPosted: 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.
metachief




PostPosted: 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.
apomb




PostPosted: Fri Jun 06, 2008 3:04 pm   Post subject: RE:Reading files in a folder

yes it is...
Turing:
openfile

just read each line in, assign each to an array element, and VOILA.

then do a
Turing:
loop
music.playfile(array[x])
end loop
metachief




PostPosted: 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...
riveryu




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: 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.
metachief




PostPosted: Sat Jun 07, 2008 11:39 pm   Post subject: RE:Reading files in a folder

Thanks for the help guys.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: