Sign in to follow this  
Followers 0
sosimple

How can I rename something in a .txt file?

3 posts in this topic

I have a .txt file . Somewhere in it , it has:

password=blabla

code=blublu

How can I rename this to

password=blabla2

code=blublu2

?

Perhaps I should use IniRenameSection command , but I cant find how? ...

Share this post


Link to post
Share on other sites



You have to edit the file. If the file format corresponds to INI format, then you can use IniWrite() to update a param.

Natively, you would read the file into a variable, replace text as necessary, then write the modified variable contents to the old file name.

Too scary? Write to a new file, then on success, backup or delete the previous file.

There is also a UDF floating around that contains examples of how to get access to the file pointer, allowing for in-place file edits.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

You have to edit the file. If the file format corresponds to INI format, then you can use IniWrite() to update a param.

Natively, you would read the file into a variable, replace text as necessary, then write the modified variable contents to the old file name.

Too scary? Write to a new file, then on success, backup or delete the previous file.

There is also a UDF floating around that contains examples of how to get access to the file pointer, allowing for in-place file edits.

Thanks, you were right. IniWrite() was very helpfull.

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