.:HyPeX:. Posted July 20, 2014 Share Posted July 20, 2014 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 Link to comment
Blaawee Posted July 21, 2014 Share Posted July 21, 2014 What about these functions : fileSetPos fileGetPos Link to comment
.:HyPeX:. Posted July 21, 2014 Author Share Posted July 21, 2014 Any fileWrite will over-write text.... Link to comment
Bonsai Posted July 21, 2014 Share Posted July 21, 2014 - 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. Link to comment
Et-win Posted July 21, 2014 Share Posted July 21, 2014 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... Link to comment
.:HyPeX:. Posted July 21, 2014 Author Share Posted July 21, 2014 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now