I've just started using random access files and need to know what i'm doing wrong.
I've made a test program (just to learn how to work with them) but it dosn't work properlly.
The first part of the program reads in names entered by the user and should work like this:
read in name from user write to file repeat until user exits then add '.' to the end of the file
Then the second reads in the values like this:
read in name display name repeat this until '.' char found
The first part of the program definately works. The names get entered and stored in the file and the '.' char gets added to the end of the file.
The second part of the program does not work. If I only enter 1 name in the first program then the second program works, but if I enter more than 1 name then it loops forever outputting null as the name.
This is my code for reading in the names:
Ignore the empty catch statements as this was just a quick test. Also, there's an int called nameNumber in there which is just a number assigned to the name when it is entered in program 1.
In case no one sees your problem, I'd suggest you try debugging it yourself. Add some println() statements to the code to show where it is and what the values are. This can be an iterative process while you narrow it down. How to debug a program is a useful technique to know.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com