Compare contents of two istreams using STL (C++)
Posted on 2006-11-15
Can anybody give me a quick code snippet to compare the contents of two istreams?
In particular, I would like to be able to use this code to compare a stringstream with an ifstream, but hopefully it will generalise to pairs of istreams in general?
Code should work with MinGW and Linux (GCC). The application is for testing some routines that makes ostream output; I want to check the expected output against the real output. I'm just not sure what the preferred and efficent approach here would be, in line with STL principles.
Thanks for any ideas!