I have a folder that contains only integer files. User input writes the files so the number of files in the folder always changes.
Here is my code.
// Returns an array of pathnames of all files in a folder.
File[] fileArray = folder.listFiles();
// For each file in the file array
for ( File file : fileArray){
int[] anArray;
// Reads each file.
FileReader fr = new FileReader(file);
anArray[] = fr.read();
I want the FileReader to read the data into anArray. I cannot code the files individually like this,
anArray[0] = fr.read();
anArray[1] = fr.read();
because the number of files always changes. How do I do this?
Aucun commentaire:
Enregistrer un commentaire