Jump to content

fileWrite over-writing


Recommended Posts

Posted

Hey guys, i want to do filewrite at pos 120 in my script, without actually overwriting, so just adding stuff. But i cannot, it just overwrites stuff and fucks it up.

This is becouse i want to add custom definitions to my script, and if i add em on the end of it, it will not work.

Greetz

HyPeX

Posted

- Get everything until that position

- Get everything after that position

- add your stuff (like 1st half + new stuff + 2nd half)

- write it to a new file.

Anyway, I don't think you should actually modify a script file like this.

Posted

Get everything in the file as a string and put it on a variable. Get the position where you want to write and remove everything infront of that position and put that onto another variable. When you writed, paste the strings together and put them into a file (create a new file, overwrite it IF succeed) and save it.

I think there better ways to do it, but atleast you are sure it won't overwrite is if you do it like this...

  • Like 1
Posted

Thanks for the idea, got it to work by splitting the original script into 2 parts and saving it into a txt and using a 3rd one for the ongoing definitions, and it works perfect.

Greetz.

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...