Results 1 to 6 of 6
  1. #1
    smitsky is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Reading Next Line of File

    I'm trying to read a file in I/O. The file has 4 lines. I have to read the next 3 lines. I can read the first line. How do I read the next lines?

    I'm using com.ibm.recordio.*;

    Thanks.

  2. #2
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Reading Next Line of File

    create a while loop, try google i/o text reader while loop or something along those lines

    Writing and Reading Data from a file without BufferedReader

    that may help very similar
    Last edited by kevinn205; 12-02-2011 at 10:16 PM.

  3. #3
    smitsky is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: Reading Next Line of File

    Quote Originally Posted by kevinn205 View Post
    create a while loop, try google i/o text reader while loop or something along those lines

    Writing and Reading Data from a file without BufferedReader

    that may help very similar
    Thanks. I'll try it.

  4. #4
    smitsky is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: Reading Next Line of File

    Ok. I didn't use that code because I couldn't fit it in.

    The logic that the program provided helped. I solved the problem.

    Thanks again.

  5. #5
    srinboss is offline Member
    Join Date
    Dec 2011
    Posts
    2
    Rep Power
    0

    Default Re: Reading Next Line of File

    FileReader fr=new FileReader("filename");
    bufferedReader br=new bufferedReader(fr);
    string br.readline;
    while(br.readline()!=null)
    {
    system.out.println(br.next());
    }

  6. #6
    smitsky is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: Reading Next Line of File

    Quote Originally Posted by srinboss View Post
    FileReader fr=new FileReader("filename");
    bufferedReader br=new bufferedReader(fr);
    string br.readline;
    while(br.readline()!=null)
    {
    system.out.println(br.next());
    }
    Thank you.

    Did you look at

    com.ibm.recordio.*

    ?

    I was asked to use this, and it does not include a BufferedReader.

Similar Threads

  1. Java- Writing a file and reading a file line by line
    By Nazneen Ali in forum New To Java
    Replies: 7
    Last Post: 07-20-2011, 07:56 AM
  2. Reading a specific line from a file
    By efebatistaarda in forum New To Java
    Replies: 6
    Last Post: 02-22-2011, 02:57 PM
  3. Replies: 3
    Last Post: 06-26-2010, 08:11 AM
  4. Reading part of a line in a text file
    By aaronfsimons in forum New To Java
    Replies: 3
    Last Post: 05-04-2009, 07:57 AM
  5. Reading in data from file line by line
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 10-02-2007, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •