Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: JavatmPosted on 2007-03-05 at 17:04:59ID: 18658794
> 1 How do we read specific record in a file? (about 80% weight for this question)
g(), "\n");
)) { ins("Sampl eText")) {
Can we read the record at once? like it can be done in VB?
1. 1st is you read the file.
2. 2nd is scan the file.
BufferedReader br = new BufferedReader(new FileReader(new File("File.txt")));
> 2 How do we alter a record?
1. In relation to the above answer you have to scan it:
2. Then replace what you want.
StringTokenizer token = new StringTokenizer(br.toStrin
while(token.hasMoreTokens(
if(token.nextToken().conta
// replace the record.
}
}
> 3 How to add a new record?
1. You can append the file to add record(s):
PrintWriter pw = new PrintWriter(new FileWriter(new File("YourFile.txt")));
pw.write("Appended Record1");
pw.close().