Results 1 to 3 of 3

Thread: deleting a line

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    255

    deleting a line

    this may be a stupid question, but how would i delete a line from a file or (if asked to) modify the line?

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Here is one way. If it's a sequential file, read the file line by line. If a line is not the line you want, immediately rewrite it to a new file. Do that until the line matches the line you want to act on. To delete the line simply do not write it to the new file, otherwise modify it and write it to the new file. At EOF, kill the old file and rename the new one to the old name.

  3. #3
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    You can Split(str,VbNewline)

    Which will split the file into an array, the line # being the relative index into the array.

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