4
# bin2hex.pl by Chami.com
5
# http://www.chami.com/tips/
8
# number of characters per line
11
# -------------------------------------
21
$rem_begin = "begin binary data:";
22
$rem_end = "end binary data.";
24
# initialize for Perl strings
26
$_var = "# $rem_begin\n".
33
$_comment = "# $rem_end ".
40
$_var = "/* $rem_begin */\n".
48
$_comment = "/* $rem_end ".
53
$_var = "{ $rem_begin }\n".
62
$_comment = "{ $rem_end ".
66
if(open(F, "<".$ARGV[0]))
77
if($i >= $chars_per_line)
87
$_format, ord(getc(F)));
93
$s .= sprintf $_comment, $count;
96
$s = "\n".sprintf($_var, $count).$s;
105
"bin2hex.pl by Chami.com\n".
108
" perl bin2hex.pl <binary file>".
111
" <binary file> : path to the ".
113
" <language id> : 0 = Perl, ".
115
"2 = Pascal/Delphi\n".