Changeset 3d46f01 for tests/copyfile.cfa


Ignore:
Timestamp:
Jun 1, 2020, 2:50:37 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

change from pointers to references in tests/copyfile.cfa

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/copyfile.cfa

    r170235d r3d46f01  
    1010// Created On       : Tue Jul 16 16:47:22 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 17 18:04:44 2019
    13 // Update Count     : 26
     12// Last Modified On : Mon Jun  1 09:10:58 2020
     13// Update Count     : 28
    1414//
    1515
     
    1818
    1919int main( int argc, char * argv[] ) {
    20         ifstream * in  = &stdin;                                                        // default files
    21         ofstream * out = &stdout;
     20        ifstream & in  = stdin;                                                         // default files
     21        ofstream & out = stdout;
    2222        try {
    2323                choose ( argc ) {
    2424                  case 2, 3:
    25                           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
     25                          &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
    2727                  case 1: ;                                     // use default files
    2828                  default:
     
    3131
    3232                char ch;
    33                 *out | nlOff;                                                                   // turn off auto newline
    34                 *in  | nlOn;                                                                    // turn on reading newline
     33                out | nlOff;                                                                    // turn off auto newline
     34                in  | nlOn;                                                                             // turn on reading newline
    3535
    3636                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;
    4040                } // for
    4141        } 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!
    4444        } // try
    4545} // main
Note: See TracChangeset for help on using the changeset viewer.