home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 1.ddi / OOPWLD.ZIP / DIRECT / DIRTEST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-11  |  687 b   |  26 lines

  1. // DIRECTST.CPP : test of class dirfile
  2. #include "direct.hpp"
  3.  
  4. main() {
  5.   const size = 20;
  6.   // you can't use a const this way with ANSI C!:
  7.   dirfile dirlist[size + 1];
  8.   ffblk file_info;
  9.   int i = 0;
  10.   // find all different types of files:
  11.   int done = findfirst("*.*", &file_info, 0x37);
  12.   while(!done) {
  13.     dirlist[i++].setfile(&file_info);  // member function call
  14.     if(i >= size) {
  15.       puts("out of dirlist space");
  16.       break;  // out of while loop
  17.     }
  18.     done = findnext(&file_info);
  19.   }
  20.   i = 0;
  21.   while(dirlist[i++].print())
  22.     ;  // do it until the function returns 0 (end of the list)
  23.   for(i = 0; i < size; i++)
  24.     dirlist[i].print2();
  25. }
  26.