Results 1 to 4 of 4

Thread: Inserting text at the beginning of a text file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Posts
    244

    Inserting text at the beginning of a text file

    I am writing the app in VB.NET but this is not a .NET specific question.

    I have an already existing text file that has 200 lines. I need to insert a line at the top of the document but all I can figure out how to do is append it to the end. Can anyone point me in the right direction?

    Thanks,

    Jim

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    I hate you, my book does not have that one.....

    Best I could think of off the top of my head is to open it then save your new data over it then append the existing data to the file.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Posts
    244
    Well to be honest I have never read a file into memory, preserving its structure and then writing it to another file. Do you have the code for that?

  4. #4
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    http://www.zdnet.com.au/builder/prog...0267367,00.htm

    maybe dis will help.. why dont u like search in google.. for vb.net File I/O
    me.life = VB

Posting Permissions

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



Click Here to Expand Forum to Full Width