Results 1 to 3 of 3
- 06-19-2007, 06:51 PM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 132
- Rep Power
- 0
BufferedReader: readLine method problems
I'm reading a txt file that contents a text line under the other text line, when I read each line and then print them, it prints without the first character
for example :
Apples
bread
but the program shows this
pples
read
this is the code
any ideas?Java Code:FileInputStream _file = new FileInputStream(pFile); BufferedReader _text= new BufferedReader(new InputStreamReader(_file)); while ( _text.read() != -1 ) { System.out.println(_text.readLine()); } _text.close();
- 06-29-2007, 10:51 AM #2
Member
- Join Date
- Jun 2007
- Posts
- 2
- Rep Power
- 0
try this:
BufferedReader _text= new BufferedReader(new FileReader(yourFile));
String line ="";
while ((line=_text.readline())!=null) {
System.out.println(line);
}
- 06-30-2007, 02:27 AM #3
Senior Member
- Join Date
- Jun 2007
- Posts
- 132
- Rep Power
- 0
Similar Threads
-
Problems with readLine() and calling methods
By peachyco in forum New To JavaReplies: 2Last Post: 11-24-2007, 07:44 AM -
problems to find the main method
By christina in forum EclipseReplies: 2Last Post: 08-06-2007, 07:51 PM -
problems with replace method
By cecily in forum New To JavaReplies: 1Last Post: 08-02-2007, 09:11 PM -
Problems with method
By ai_2007 in forum Advanced JavaReplies: 1Last Post: 06-28-2007, 06:49 PM -
Problems with Find method in EJB
By Nick15 in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 05-14-2007, 01:29 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks