1

Topic: With ++ builder Search and changeover of a line

There is a text file. It is necessary to find in it a line address = "192.168.0.x" and to replace it is admissible on address = "192.168.0.yy"
Prompt as it to implement.
Thanks.

2

Re: With ++ builder Search and changeover of a line

sfsf wrote:

Prompt as it to implement.

You read a line from a file
You search in it required
Found - you replace
You write down a line in other file
To repeat while a file does not come to an end
In the end you delete an old file and you rename on its place the old.
Everything, a telemarket.

3

Re: With ++ builder Search and changeover of a line

Not, well for example for
AnsiString stroka
It is possible in a combination f-tsy
stroka. Pos ()
stroka. SubString ()
stroka. Length

4

Re: With ++ builder Search and changeover of a line

exp98;
If a file small, it is possible to load it entirely;
And one call f-tsii AnsiReplaceStr to make changeover
TStringList *Text = new TStringList;
Text-> LoadFromFile ("IPLIST.TXT");
Text-> Text = AnsiReplaceStr (Text-> Text, "192.168.0.13", "192.168.0.14");
Text-> SaveToFile ("IPLIST.TXT");
delete Text;