home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / NEWPC_TP.ZIP / BYTES.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-11-02  |  1.3 KB  |  46 lines

  1. Program pc_disk;
  2. {$C-}
  3. Type
  4.   word         = array [1..2] of char;
  5.   cat_type     = record
  6.                    vol_record : integer;
  7.                    fil        : string[11];
  8.                    sizelo     : word;
  9.                    sizehi     : word;
  10.                    time       : word;
  11.                    date       : word;
  12.                    memo       : string[33];
  13.                  end;
  14.  
  15. Var
  16.   fname,volume                  : string[14];
  17.   tbytes, bytes                         : real;
  18.   catfile                       : file of cat_type;
  19.   one_cat                       : cat_type;
  20.   catname                       : string[14];
  21.   x                             : integer;
  22.  
  23. begin
  24.   bytes := 0.0;
  25.   x := 0;
  26.   write ('Enter file to check ');
  27.   readln (catname);
  28.   assign (catfile,catname);
  29.   reset(catfile);
  30.   while not eof(catfile) do
  31.     begin
  32.       read (catfile, one_cat);
  33.       if one_cat.vol_record <> -1 then
  34.         begin
  35.           tbytes := ord(one_cat.sizelo[1]) + ord(one_cat.sizelo[2])*256.0 +
  36.                     ord(one_cat.sizehi[1])*65536.0;
  37.           bytes := bytes + tbytes;
  38.           x := x + 1;
  39.         end;
  40.     end;
  41.   close(catfile);
  42.   writeln;
  43.   writeln ('Total files = ',x);
  44.   writeln ('Total bytes = ',bytes:8:0);
  45. end.
  46.