A
Alex Vinokur
------ foo.cpp : BEGIN ------
#include <cassert>
#include <vector>
#include <string>
#include <iostream>
#include <iterator>
#include <fstream>
using namespace std;
int main ()
{
ifstream f("foo.in", ios_base::binary);
assert (f);
istream_iterator<string> b(f), e;
cout << "(1) File : ";
copy (b, e, ostream_iterator<string> (cout, " "));
cout << endl;
cout << "(2) File : ";
copy (b, e, ostream_iterator<string> (cout, " "));
cout << endl;
return 0;
}
------ foo.cpp : END --------
------ Compilation & Run : BEGIN ------
$ g++ --version
g++ (GCC) 3.3.1 (cygming special)
[---omitted---]
$ g++ -mno-cygwin foo.cpp
$ a
(1) File : abc xyz ijk pqr
(2) File : abc
------ Compilation & Run : END --------
Why do two copy()'s produce different output?
#include <cassert>
#include <vector>
#include <string>
#include <iostream>
#include <iterator>
#include <fstream>
using namespace std;
int main ()
{
ifstream f("foo.in", ios_base::binary);
assert (f);
istream_iterator<string> b(f), e;
cout << "(1) File : ";
copy (b, e, ostream_iterator<string> (cout, " "));
cout << endl;
cout << "(2) File : ";
copy (b, e, ostream_iterator<string> (cout, " "));
cout << endl;
return 0;
}
------ foo.cpp : END --------
------ Compilation & Run : BEGIN ------
$ g++ --version
g++ (GCC) 3.3.1 (cygming special)
[---omitted---]
$ g++ -mno-cygwin foo.cpp
$ a
(1) File : abc xyz ijk pqr
(2) File : abc
------ Compilation & Run : END --------
Why do two copy()'s produce different output?