• Post Reply Bookmark Topic Watch Topic
  • New Topic

Specific file content  RSS feed

 
Mark Phylus
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 30 columns in a text file and I need to read and console display 7 columns. Anyone knows how to do this? I'd appreciate this very much.
[ April 12, 2004: Message edited by: Mark Phylus ]
 
Joe Ess
Bartender
Posts: 9441
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really an "advanced" question, but what the hey. Let's look at this loop:

In the java documentation for java.io.BufferedReader,
it says that in.ready() indicates if the stream can be read from without blocking. The documentation does not say it is a reliable test for end-of-file, so it probably is not a good loop test.
Are you reading more than one line? Setting a variable inside a loop and printing it out outside the loop will only print the latest value.
Are you only reading one line? Then why do you have the loop?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!