Results 1 to 2 of 2
  1. #1
    mokonji is offline Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0

    Default Writing To A Specific Text File Line

    In a program I am writing I need to be able to write to the end of a specific line in a textfile. I'm not sure of any particular way to do this apart from perhaps rewriting the whole textfile which would be a pain to do. Does anyone know of a simpler way of how to do this?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    If you think about how text files are stored on a hard drive, can you picture any way any computer program can write to a specific point in the file without over writing the file? If you tried to write data in at a specific point in the file, you'd be over-writing any data that normally would follow the starting point, and that won't do.

    Unless you're talking about randomaccess files (and I don't recommend that here), you're probably better off over-writing the entire file.

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, 06:28 PM
  2. Replies: 6
    Last Post: 12-12-2008, 04:35 PM
  3. Saving To A New Line Using A Text File
    By jadaleus in forum Advanced Java
    Replies: 10
    Last Post: 10-24-2008, 08:21 PM
  4. Saving To A New Line Using A Text File
    By jadaleus in forum Advanced Java
    Replies: 1
    Last Post: 10-24-2008, 01:31 AM
  5. writing text to file
    By notwist in forum New To Java
    Replies: 3
    Last Post: 04-25-2008, 05: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
  •