[llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 6 20:07:01 PDT 2003
Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++:
reversefile.cpp added (r1.1)
---
Log message:
new testcase
---
Diffs of the changes: (+25 -2)
Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp
diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp:1.1
*** /dev/null Mon Oct 6 20:06:06 2003
--- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp Mon Oct 6 20:05:56 2003
***************
*** 0 ****
--- 1,25 ----
+ // -*- mode: c++ -*-
+ // $Id: reversefile.cpp,v 1.1 2003/10/07 01:05:56 lattner Exp $
+ // http://www.bagley.org/~doug/shootout/
+ // with help from Allan Stokes
+
+ #include <iostream>
+ #include <deque>
+ #include <string>
+ #include <algorithm>
+
+ using namespace std;
+
+ int main() {
+ typedef deque<string> LINES;
+ LINES l;
+ char line[256];
+ char buff[4096];
+ cin.rdbuf()->pubsetbuf(buff, 4096); // enable buffering
+ cout.rdbuf()->pubsetbuf(buff, 4096); // enable buffering
+
+ while (cin.getline(line, 256)) {
+ l.push_front(line);
+ }
+ copy (l.begin(), l.end(), ostream_iterator<string>(cout,"\n"));
+ }
More information about the llvm-commits
mailing list