[b]hi dear developers,
(got a big poly modeled with red shaded question mark on top o'my head:Waits to be deployed after good answer by experts.)
fwrite or fprint always returns 0.[/b]
How can I open a file to modify it ? not looking for appending to end of file.looking for changing or inserting
ie. I got already a test.mel file. and ı wantto add "Hello There" after first existence of line "I am an existing code".
the sampel code below fwrite always returns 0.
in conclusion is it possible to open an existing file and add/change/delete some line an resave it ?
(thank you for sharing your experiences.)
string $dir=C:/;
string $file=$dir+"test.mel";
$fileId=fopen $file "r+";
string $nextLine = "";
while (!gmatch $nextLine "*I am an existing code*")
{
$nextLine = fgetline $fileId;
}
fwrite $fileId "Hello there\r\n";
fclose $fileId;