This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Compiles and core dumps
- To: <egcs-bugs at cygnus dot com>
- Subject: Compiles and core dumps
- From: "Bruce Eckel" <Bruce at EckelObjects dot com>
- Date: Tue, 5 Jan 1999 22:47:59 -0800
- Reply-To: "Bruce Eckel" <Bruce at EckelObjects dot com>
This compiles fine, but core dumps when you run it (RedHat Linux 5.2,
Reading specs from
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.92.33/specs
gcc version egcs-2.92.33 19981226 (gcc2 ss-980609 experimental)
//: C20:StreamIt.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Iterators for istreams and ostreams
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
int main() {
ifstream in("StreamIt.cpp");
istream_iterator<string> init(in), end;
ostream_iterator<string> out(cout, "\n");
vector<string> vs;
copy(init, end, back_inserter(vs));
copy(vs.begin(), vs.end(), out);
out = vs[0];
out = "That's all, folks!";
} ///:~
=============================
Bruce Eckel http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java" & "Thinking in C++ 2e"