Jump to content

Insert Line into the file

Recommended Posts

Hi, guys,

Need some help on the coding, after reading the help file and reading the forum, somehow i cant find something i need, so i would like to post my(probably a simple question) question. Hope you guys can really help me on this.

I actually need to insert a line of text into the file. but if i ise filewrite or filewriteline. it always append it after the last line. i actually wanna insert the line probably in the middle of the file after i do the comparison.

for example

1 1

2 2

3 4

4 5


after i do comparison, i found that 3 is missing, so i need to insert no.3 after 2, but using filewrite..it will insert the 3 after the no.5

can it be done?Please advise.


Link to comment
Share on other sites

read the whole file into memory

write the file up to the point where you want to add your line

write your line

write the rest of the file from memory

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...