Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading and appending to text file

Status
Not open for further replies.

papaboy2

MIS
Jan 28, 2003
52
PH
hi how can i concatenate and removove blank space between two lines of data in a text file and also how can i append at the bottom, not overwrite the existing data?
i have a [mes] part where the data is continued with a blank space, how can i display it in ony 1 straight line, using the System.out.println?

[tim]July 10 1999 at 19:04:30
[mes]Sample message broken

Message to concat on first message

[end]

here is my code:
input = new BufferedReader( new FileReader(aFile) );
String line = null; //not declared within while loop
while (( line = input.readLine()) != null){
System.out.println(line);
 
I take it that from your other post, you found out how to append to files ?

--------------------------------------------------
Free Database Connection Pooling Software
 
yep i can append but the problem is that the NEW data is appended right next to the last data appended, and not in the next line of the file, and also i want to retrieve multiple lines of data into single straight message, removing also with blank space between lines. thanks you sedj for your time! just a novice in java hayyyyy .
 
I showed you how to resolve this in your other post ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top