HEX
Server: Apache
System: Linux iad1-shared-e1-13 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: dh_x7ke6i (5503775)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //usr/share/jed/lib/binary.sl
% It is used to read a file in binary mode.

define find_binary_file ()
{
   variable file, bytes, len, pos;

   file = read_file_from_mini ("Find Binary File:");
   try
     {
	set_file_translation (1);
	() = find_file (file);
     }
   finally set_file_translation (0);
   no_mode();
   set_overwrite(1);
   %
   %  set the binary file flags
   getbuf_info();
   setbuf_info(() | 0x200);

   bytes = count_chars();
   if (string_match(bytes, ".*of \\([0-9]+\\)$", 1))
     {
	(pos, len) = string_match_nth(1);
	bytes = substr(bytes, pos + 1, len);
	message (bytes + " bytes.");
     }
}