Jump to content
Sign in to follow this  
skywalker

Insert Line into the file

Recommended Posts

skywalker

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

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.

thanks

Share this post


Link to post
Share on other sites
blindwig

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.