THE CONTENTS FROM FILE IS:usiness
THE CONTENTS FROM FILE IS:personal
so that when i enter business it doesn't go in to the loop which checks for equality.
please help.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32421
posted
0
The first character is eaten by the "check=reader1.read()" statement. I don't think you need that anyway - you can check the file for being empty via "myF.length() == 0".
Look at the Javadocs for BufferedReader's read() method: what do you expect to happen?
gayathri murugesan
Ranch Hand
Joined: Dec 21, 2009
Posts: 31
posted
0
i would like to retrieve the contents from folderwithmsg.txt file and then compare with the fileName given by user.if the filename is not present in the text file,i should write in the text file.otherwise i should not.as the first character is being omitted,whenever the filename equals the first name in the text file ,it is writing in the file.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
You were already told why the first character is being read, given a link to the documentation to prove it, and provided a workaround--what else do you need?
This message was edited 1 time. Last update was at by David Newton
gayathri murugesan
Ranch Hand
Joined: Dec 21, 2009
Posts: 31
posted
0
with length method also i m getting the same type of problem.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
I think you should take a step back and re-examine the problem, and the hints you've been given.
This message was edited 2 times. Last update was at by David Newton
pramod reddy
Greenhorn
Joined: Jan 10, 2008
Posts: 15
posted
0
Hello gayathri murugesan ;
just go through my code and find mistake..
this code is working........
This message was edited 2 times. Last update was at by pramod reddy