Unfortunately, it is not possible to replace 4 bytes with 5 bytes in same file without overwriting other bytes (except if writing to end of file). And, it is not possible to replace 5 bytes with 4 bytes. For that situations you need to 1)rename original file to some different name, 2) create new file with same name as original file and 3)stream data to new file from from original renamed file.wallgod wrote:So for example, if I wanted to replace "Span" with "Spain", the result would be "Spai".
With this function, if you replace 5 bytes with 4 bytes then it appends additional (5th) empty byte to that 4 bytes so they are equal.