Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File Compare

File Compare

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    P Gibson
    wrote on last edited by
    #1

    I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

    O V G S T 5 Replies Last reply
    0
    • P P Gibson

      I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

      O Offline
      O Offline
      Optimus Chaos
      wrote on last edited by
      #2

      Why don't you take a look at WinDiff? Alternatively you could consturct 2 CStdioFile obejcts, ReadLine() 'em and store the values in CStringArray's. Those in memory representations can be read faster than the actual files. Actually it reminds me of a similar task I had to do when I learend programming, so feel free to ask me any questions ;-)

      1 Reply Last reply
      0
      • P P Gibson

        I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

        V Offline
        V Offline
        vikas amin
        wrote on last edited by
        #3

        To compare files as big as 5MB is crucial task , putting the data in memory & comparing will be fast. :-> can suggest one tip , keep a log of the file last modified and check for the size and time of modification . If there is not change in size , then u dont need to compare the data of file. :cool: Vikas Amin Embin Technology Bombay vikas.amin@embin.com

        1 Reply Last reply
        0
        • P P Gibson

          I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

          G Offline
          G Offline
          grigsoft
          wrote on last edited by
          #4

          You can find WinDiff sources, or have a look at WinMerge.sf.net. Comparison itself could be a hardest part, since there are plenty of algorithms. You can search for MYERS's Difference Algorithm. Igor Green http://www.grigsoft.com/ Compare It! + Synchronize It! - files and folders comparison never was easier! Igor Green http://www.grigsoft.com/ - files and folders comparison tools

          1 Reply Last reply
          0
          • P P Gibson

            I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

            S Offline
            S Offline
            SilentSilent
            wrote on last edited by
            #5

            P Gibson wrote:

            Any recommendations as to what to use, or any examples available would be most appreciated.

            Go to the top of this page and type 'diff' into the Search field. ;)

            1 Reply Last reply
            0
            • P P Gibson

              I'm writing a C++ application that needs to compare two text files for differences (addition/changes/deletion of an line), so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB. The output could be either to another text file or a List Control. Any recommendations as to what to use, or any examples available would be most appreciated.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              P Gibson wrote:

              so some source code for comparing is required that is fast (and accurate) as some files maybe more than 5MB in size, but usually will be several hundred KB.

              What about using Memory Mapped Files, Link :- http://www.codeproject.com/win32/cmemmap.asp[^]

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups