Results 1 to 3 of 3
  1. #1
    mickmos is offline Member
    Join Date
    Apr 2009
    Posts
    5
    Rep Power
    0

    Default writing to specific line in text file

    hi guys this is my first post in this forum so if its in the wrong area i apologise.
    can someone tell me if its possible to write things to a specific line in a text file. for example i want to store the values for 3 ints and some names that go with them. is it possible in java to to something like write to line(3) and then read from line(3), any help would be greatly appreated
    thanks.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I'm not clear exactly what you want to do. Trying to write something to text file, the location/line number specified earlier, is it?

    Yes, it's possible in Java. How did you try to do it.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    best to read in the file, either whole, or if too big, as a stream, and then write out the file with the new data added.

Similar Threads

  1. Help! - How to insert a new line to a text file
    By matpj in forum New To Java
    Replies: 13
    Last Post: 02-24-2010, 05:28 PM
  2. Writing To A Specific Text File Line
    By mokonji in forum New To Java
    Replies: 1
    Last Post: 03-02-2009, 08:13 PM
  3. Replies: 6
    Last Post: 12-12-2008, 03:35 PM
  4. Saving To A New Line Using A Text File
    By jadaleus in forum Advanced Java
    Replies: 10
    Last Post: 10-24-2008, 07:21 PM
  5. writing text to file
    By notwist in forum New To Java
    Replies: 3
    Last Post: 04-25-2008, 04:20 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
  •