After Work
The best club in Chicago
for Chicago Singles is
Highlife Adventures!
Are you looking for a
Jersey Girl T-Shirt
?
Kyoto Sushi
in Chicago, on Lincoln Ave.
Moody's Pub
in Chicago, has great burgers
Skylark
in Chicago, on Halsted .. excellent Friday fish fry!
|
UNIX
»
Perl
»
Coding
»
Compare Two Binary Files
#!/usr/bin/perl
#----------------------------------------
# Compare two binary files
# See comments below for modifications
#----------------------------------------
$file1 = $ARGV[0];
$file2 = $ARGV[1];
$size1 = -s $file1 ;
open(FILE1,"<$file1") or die "Input file: Cannot open file1\n\n";
open(FILE2,"<$file2") or die "Input file: Cannot open file2\n\n";
$i = 0 ;
$j = 0 ;
while ($i < $size1 )
{
$i ++ ;
$ch1 = getc(FILE1);
$ch2 = getc(FILE2);
print $ch1 . $ch2 . "\n" ;
if (!($ch1 eq $ch2))
{
print "Difference detected at character: " . $i . "\n" ;
$j ++ ;
}
# diff limiter: edit this line to modify
# the number of differences before exiting program
if ($j > 15)
{
exit ;
}
}
close(FILE1);
close(FILE2);
|
|
|
|