Michael Jackson
2009-02-23 18:13:55 UTC
I find this solution simple & interesting:
I'll need to find the following sequence of bytes (hex): 32 35 35 2E 32 35 35 2E 32 35 35 2E 32 35 35. Read the file byte-by-byte, and try to match the pattern. If/when you do find that sequence, you'll write out the new IP address starting at the location you found the first '2'.
Rather than trying to overwrite the original file, it's probably easier to create a new file with the altered sequence of bytes. You should be able to do it in one pass, and you won't need to read the entire file into memory. Maybe just a buffer of 15 bytes, a sliding window that you move through your input file, would do the trick.
********************************************************************************
************
QUESTION:
>>You should be able to do it in one pass, and you won't need to read the entire file into memory. Maybe just a buffer of 15 bytes, a sliding window that you move through your input file, would do the trick
Can you re-explain the above part to me please? - A sliding window that you move through your input file, would do the trick, does sliding window here means reading data in fragments or this a special term for developers? - I guess its my lack of English sometimes puts barrier on me...