Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem while Reading File  RSS feed

 
Bibhudutta Pradhan
Ranch Hand
Posts: 31
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The program gives the out put but with the missing first letter of every line.

Please Help

 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your bfr.read() call reads a single character each time, after which your readLine() gets the rest of the line. Use this instead:
 
Rajasekhar Pentakota
Ranch Hand
Posts: 38
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pointer moves forward. when you use read() method it moves the pointer one character right.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!