Hey,
I am working on a binary file and need to get certain values out of the file and be able to use them as readable values, hex or decimal. I was thinking un/pack can help me but not too sure. Here is my code:
open(INFO,"<$file"
|| die "Can't open $file: $!\n";
seek (INFO, $MemAddr,0);
if ( 4 != (read INFO, $mdsa, 4))
{
print qq?***ERROR!****\nCounld not read Start
Address, Concatination Stoped.\n?;
exit;
}
print OUTF1 $mdsa;
$MDSA = unpack ("H",$mdsa)
if ($MDSA != $DefFileSize)
{
print qq? Wrong File Size\n Aborted\n?;
exit;
}
else { .....}
I print the binary data to a file, OUTF1, for testing and I am getting the correct data (I tell by an octal dump), but how do I use that data inside the script, with out od the output file?
I am working on a binary file and need to get certain values out of the file and be able to use them as readable values, hex or decimal. I was thinking un/pack can help me but not too sure. Here is my code:
open(INFO,"<$file"
seek (INFO, $MemAddr,0);
if ( 4 != (read INFO, $mdsa, 4))
{
print qq?***ERROR!****\nCounld not read Start
Address, Concatination Stoped.\n?;
exit;
}
print OUTF1 $mdsa;
$MDSA = unpack ("H",$mdsa)
if ($MDSA != $DefFileSize)
{
print qq? Wrong File Size\n Aborted\n?;
exit;
}
else { .....}
I print the binary data to a file, OUTF1, for testing and I am getting the correct data (I tell by an octal dump), but how do I use that data inside the script, with out od the output file?