Re: Fast way to compare two files using STL?

Discussion in 'C++' started by Thomas Matthews, Aug 18, 2003.

  1. John Villalovos wrote:

    > I was wondering if people had any ideas on a fast way to compare two files (on
    > Linux) using the STL.

    Files are in the domain of the operating system.
    Operating systems should be very good at copying and comparing files.
    Use either a system command:
    system("diff file_a file_b > results")
    or system specific functions.

    Also, there are a plethora of file compare utilities. Check them
    out.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c++/faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
     
    Thomas Matthews, Aug 18, 2003
    #1
    1. Advertisements

  2. In article <MG50b.26708$>,
    Thomas Matthews <> wrote:
    >John Villalovos wrote:
    >
    >> I was wondering if people had any ideas on a fast way to compare two files
    >> (on Linux) using the STL.

    >Files are in the domain of the operating system.
    >Operating systems should be very good at copying and comparing files.
    >Use either a system command:
    > system("diff file_a file_b > results")
    >or system specific functions.
    >
    >Also, there are a plethora of file compare utilities. Check them
    >out.


    Thanks.

    I'll be honest and say, Yuck! :) I don't like writing code which does a
    "system()" call. Must be my personality :) But you are right in that diff
    works well and is quite fast.

    John
     
    John Villalovos, Aug 18, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. windandwaves
    Replies:
    1
    Views:
    553
    Daniel Tryba
    Mar 24, 2005
  2. vaggelis
    Replies:
    0
    Views:
    3,724
    vaggelis
    Jul 13, 2003
  3. Frank
    Replies:
    1
    Views:
    916
    Dimitre Novatchev
    Sep 12, 2003
  4. Tim Smith
    Replies:
    0
    Views:
    794
    Tim Smith
    Sep 29, 2004
  5. Gianni Mariani
    Replies:
    1
    Views:
    1,056
    Pete Becker
    Aug 16, 2003
  6. GenxLogic
    Replies:
    3
    Views:
    1,969
    andrewmcdonagh
    Dec 6, 2006
  7. Atlas
    Replies:
    10
    Views:
    1,621
    Ivan Vecerina
    Nov 18, 2005
  8. Replies:
    5
    Views:
    759
    Markus Schoder
    Apr 16, 2006
Loading...