Sign in to follow this  
Followers 0
Guest Marauder2k

Search & Replace string

2 posts in this topic

I have a standard text file which I'd like to search for a string, replace it, and save the file again.

The main part I'm having trouble with is the filewrite command. How can I get it to actually replace the string instead of just adding the new changed string to the end of the file?

This is what I have so far:

$file = FileOpen("setup1.txt", 1)
$aaa=StringReplace("%programfiles%", "programfiles", @programfilesdir, 0, 0)
FILEWRITE($file, $aaa)
FILECLOSE($file)

Thanks

Share this post


Link to post
Share on other sites



Works perfect. Thankyou very very much :ph34r:

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  
Followers 0