Jump to content
Sign in to follow this  
Guest Marauder2k

Search & Replace string

Recommended Posts

Guest Marauder2k

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
Guest Marauder2k

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  

×