Changeset 3d46f01 for tests/.expect/copyfile.txt
- Timestamp:
- Jun 1, 2020, 2:50:37 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4e7c0fc0
- Parents:
- 170235d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/copyfile.txt
r170235d r3d46f01 10 10 // Created On : Tue Jul 16 16:47:22 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 17 18:04:44 201913 // Update Count : 2 612 // Last Modified On : Mon Jun 1 09:10:58 2020 13 // Update Count : 28 14 14 // 15 15 … … 18 18 19 19 int main( int argc, char * argv[] ) { 20 ifstream * in = &stdin;// default files21 ofstream * out = &stdout;20 ifstream & in = stdin; // default files 21 ofstream & out = stdout; 22 22 try { 23 23 choose ( argc ) { 24 24 case 2, 3: 25 in = new( (const char *)argv[1] ); // open input file first as output creates file26 if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent25 &in = new( (const char *)argv[1] ); // open input file first as output creates file 26 if ( argc == 3 ) &out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent 27 27 case 1: ; // use default files 28 28 default: … … 31 31 32 32 char ch; 33 *out | nlOff; // turn off auto newline34 *in | nlOn;// turn on reading newline33 out | nlOff; // turn off auto newline 34 in | nlOn; // turn on reading newline 35 35 36 36 for () { // read all characters 37 *in | ch;38 if ( eof( *in ) ) break; // eof ?39 *out | ch;37 in | ch; 38 if ( eof( in ) ) break; // eof ? 39 out | ch; 40 40 } // for 41 41 } finally { 42 if ( in != &stdin ) delete( in );// close file, do not delete stdin!43 if ( out != &stdout ) delete(out ); // close file, do not delete stdout!42 if ( &in != &stdin ) delete( &in ); // close file, do not delete stdin! 43 if ( &out != &stdout ) delete( &out ); // close file, do not delete stdout! 44 44 } // try 45 45 } // main
Note: See TracChangeset
for help on using the changeset viewer.