I am working on comparing to large files...... i want to comapres blocks of two file. first is a file and second is updated file. If i will compare two files by given command or string by string it will take too long time. SO i think that i will compare blocks of two files and try to find out changes in file. But if one block in between is changed then all block below that are not able to match. Can any one help me in this. I wan to know how to access a block of a file? how to compare them??
Simply reading the file in a specific block and compare, it is what WinDiff/DOS fc programs do. I PHP for example, I would do: fread($file,1024), which will read it in block of 1024 bytes. Peace,
The difficulty with block comparisons is deciding what comprises a block. With text it is somewhat simplified since the data is broken into lines ending with \n and you can work out when blocks are alike. With other data it is not so simple and in the worst case a block may be 1 byte long making a comparison useless.