Thread: Large Binary Compare

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    4

    Question Large Binary Compare

    I am trying to extract the Difference between 2 large data files.

    I am currently Reading x bytes of each file into 2 buffers and performing a stricmp(file1buf, file2buf). If the 2 buffers are equal then I move on. However, if they are not equal then I have a very slow routine that searches, character-by-character, for where the files match up again.

    This method is not good because of the possibility that there are unrelated parts in the files that appear identical to my pattern search.

    Does anyone have any neat ways of finding a block in file A that does not exist in file B?

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    87
    You could start by looking at the half of the file, comparing it, if the first half don't match then half it again, and so on untill you find a small code fragment, about 10charcters or so that don't match then find the one that is not matching.
    **********************
    *==================*
    * Many Can. One Must... *
    *==================*
    **********************

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Large file][Value too large for defined data type]
    By salsan in forum Linux Programming
    Replies: 11
    Last Post: 02-05-2008, 04:18 AM
  2. Confused by expression.
    By Hulag in forum C Programming
    Replies: 3
    Last Post: 04-07-2005, 07:52 AM
  3. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  4. binary search and search using binary tree
    By Micko in forum C++ Programming
    Replies: 9
    Last Post: 03-18-2004, 10:18 AM
  5. Array, Linked List, or Binary Tree?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 01-05-2002, 10:07 PM