home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / JED / JED097-1.TAR / jed / lib / binary.sl < prev    next >
Encoding:
Text File  |  1994-12-12  |  631 b   |  30 lines

  1. % It is used to read a file in binary mode.
  2.  
  3. define find_binary_file ()
  4. {   
  5.    variable file, bytes, len, pos;
  6.    
  7.    file = read_file_from_mini ("Find Binary File:");
  8.    ERROR_BLOCK
  9.      {
  10.     set_file_translation (0);
  11.      }
  12.    set_file_translation (1);
  13.    find_file(file); pop();
  14.    EXECUTE_ERROR_BLOCK;
  15.    no_mode();
  16.    set_overwrite(1);
  17.    %
  18.    %  set the binary file flags
  19.    getbuf_info();
  20.    setbuf_info(() | 0x200);
  21.    
  22.    bytes = count_chars();
  23.    if (string_match(bytes, ".*of \\([0-9]+\\)$", 1))
  24.      {
  25.     string_match_nth(1); =len; =pos;
  26.     bytes = substr(bytes, pos + 1, len);
  27.     message (strcat(bytes, " bytes."));
  28.      }
  29. }
  30.