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

Username:   Password: 
 RegisterRegister   
 Another files question...reading unkown files?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Aziz




PostPosted: Thu Jul 07, 2005 11:31 am   Post subject: Another files question...reading unkown files?

Smile Hello again, yes I have yet another question. How would I read a list of files from a directory. For example: Say a program (that i made) writes a person's name, age, birthday, and description to a file name "FirstLastAge.chr" into a folder called "files". Now I'm making a program to read a list of these files like this:

What file would you like to open?

FirstLastAge1.chr
FirstLastAge2.chr
FirstLastAge3.chr
FirstLastAge4.chr
FirstLastAge5.chr
FirstLastAge6.chr

EDIT: Nevermind, I figured it out. Using the list() method of a File object initalized as a directory
Java:
String[] fileNames = new File("files\\").list()
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: