| Author |
read text file
|
brian yuen
Greenhorn
Joined: Oct 20, 2003
Posts: 20
|
|
the above code can read a text file form the beginning, but what if i wanna read from the second line or third line of the text file unitl the end, what should i change... thnaks
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9944
|
|
|
you could add a for-loop before the while-loop that reads (and ignores) the first x lines you want to ignore.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
brian yuen
Greenhorn
Joined: Oct 20, 2003
Posts: 20
|
|
|
for loop?what should inside the for lopp
|
 |
Vinod Chandana
Ranch Hand
Joined: Aug 26, 2003
Posts: 59
|
|
String line = ""; for(int i = 0; i < 2; i++) br.readline(); while((line = br.readLine()) != null) This should work. - Vinod.
Originally posted by brian yuen: the above code can read a text file form the beginning, but what if i wanna read from the second line or third line of the text file unitl the end, what should i change... thnaks
|
 |
brian yuen
Greenhorn
Joined: Oct 20, 2003
Posts: 20
|
|
|
oh i see, skipping some lines...thanks a lot.
|
 |
 |
|
|
subject: read text file
|
|
|