I can't find an example on how to read a text (sequential) file to an array. Anybody knows how to? By the wqay, if you can tell me how to do the reverse, it would be nice also
well, if you can do one way, you can basically just reverse and do backwards, though you will need write file privileges to write file, whereas just read privileges to read file.
to read a file line by line:
Code:
String line= "";
BufferedReader textIn = new BufferedReader(new FileReader(new File("filename.ext")));
line = textIn.readLine();
while (line != null){
do something, like add array element
}
which leads to a ? what type of array? Does it have to be array?
And better yet of what size, as you will need to declare this size. Something like a Vector may be more useful.
Hum...I think I'm getting somewhere here. It's an entrance control application and it has to be done with an array of type StudentCard. Each student card contains several atributes: I'm attaching the text file with this post. Mainly, I'll have to load everything from the file to the array, work on it and resend it to the file. Each position of the array will have one student card.