0
How can I insert text in the middle of existing text with fwrite() function?
..
3 Answers
+ 3
$doc = fopen("file.txt", "r+") ;
$doclen = ftell($doc) ;
fseek($doc, SEEK_SET, $doclen/2);
fwrite($doc, "Hello") ;
fclose() ;
#Hope it Helps
+ 1
what about if i don't know how many bytes from beginning is position what i need... is any simple method to find text in the file?
P.S. found somewhere that fseek not work with a and a+ mode, so we must use r or c, but what difference between them
+ 1
Thanks Ishola. That is not exactly what I need, but you are right - that is answer to my question at the topic.