Computer Science Canada

Another files question...reading unkown files?

Author:  Aziz [ 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()


: