Reading a specific line in a .txt file

Hi

I want to make a program that reads a specific line in a.txt file, and writes to a specific line in the .txt file.

I have made a program wich you can log in to. When you have typed your username and a password it looks for a file: "yourusername".txt

and checks if the password is correct.

The password lays on the first line of the file.

And i want to store more information on the other lines.

So do anyone knows how to read from a specific line and write to a specific line in a .txt file?

Please tell me

[559 byte] By [javaguy387a] at [2007-11-27 10:02:41]
# 1

Hi,

You need to read all lines till you reach the one that you are looking for.

Writing is a bit harder. Writing data means that you will write over the data that is located where you want to write, so you need to read in all data after the write position. Write the new data, and then write the old data (that you want to keep) back to the file.

Kaj

kajbja at 2007-7-13 0:37:03 > top of Java-index,Java Essentials,Java Programming...
# 2
Try using properties... That may help you... look for: http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
@@CKM@@a at 2007-7-13 0:37:03 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks a lot guys
javaguy387a at 2007-7-13 0:37:03 > top of Java-index,Java Essentials,Java Programming...