home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / GCSTRI / TESTGC.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-25  |  1.1 KB  |  40 lines

  1. /**************************************************************************
  2. These C++ classes are copyright 1989, 1990, 1991 by William Herrera.
  3. I hereby release this source code for free distrubution and use.
  4. If you modify it and distribute it, please indicate any changes you
  5. make as your own and the code as copyrighted above.
  6. **************************************************************************/
  7. #include <time.h>
  8. #include <stdlib.h>
  9. #include <dos.h>
  10. #include <fstream.h>
  11. #include <alloc.h>
  12.  
  13. #include "error.hpp"
  14. #include "gcstring.hpp"
  15.  
  16. int main(int argc, char ** argv)
  17. {
  18.     if(argc != 2)
  19.         Error("Usage: ", argv[0], " filename", -1);
  20.     char * filename = argv[1];
  21.     cout << farcoreleft() << "\n";
  22.     ifstream from(filename);
  23.     if(!from.good())
  24.         Error("Cannot find, open or use file ", argv[1], " ", -2);
  25.     gcstring s;
  26.     time_t t1 = time(NULL);
  27.     while(from.good())
  28.     {
  29.         gcstring s1, s2;
  30.         from >> s1;
  31.         from >> s2;
  32.         s = s1.uppercase() + "\n" + s2.lowercase() + "\n";
  33.         cout << s;
  34.     }
  35.     time_t t2 = time(NULL);
  36.     cout << farcoreleft();
  37.     cout << "\nElapsed time is " << (t2 - t1) << " sec";
  38.     return 0;
  39. }
  40.