Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

mycat.C

Go to the documentation of this file.
00001 
00002 // mycat.C - Write stdin to stdout (to test the g++ piping bug)
00003 
00004 #  include  <stdio.h>
00005 #  include  <stdlib.h>
00006 #  include  <iostream.h>
00007 
00008 int get_line(istream & str, char * line)
00009 {
00010     str.get(line, 256, '\n');
00011     if (str.eof()) return 0;
00012 
00013     char c;
00014     str.get(c);
00015     return 1;
00016 }
00017 
00018 main()
00019 {
00020     char line[256];
00021     while (get_line(cin, line)) {
00022 
00023         cout << line << endl << flush;          // Doesn't work!
00024 
00025 //      fprintf(stdout, "%s\n", line);          // Works!
00026     }
00027     fprintf(stdout, "%s\n", line);
00028     fflush(stdout);
00029 }

Generated at Sun Feb 24 09:57:10 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001