in reply to Re: problem with sysseek in loop
in thread problem with sysseek in loop

this is the final revised working code:

use File::Path qw(make_path); open (my $infile, '<', 'file') or die "cannot open file: $!"; binmode ($infile); make_path ('./extracted'); my $curpos = ''; my $fileLocation = ''; my $fileSize = ''; my $fileName = ''; my $file =''; my $chunk = ''; my $empty = ''; #GET File Location, File Size, File Name and write to file seek ($infile, 0x10, 0); until ($curpos =~ 0x04c0){ $curpos = tell $infile; seek ($infile, $curpos, 0); read ($infile, $fileLocation, 0x08); $curpos = tell $infile; seek ($infile, $curpos, 0); read ($infile, $fileSize, 0x08); $curpos = tell $infile; seek ($infile, $curpos, 0); read ($infile, $fileName, 0x20); $curpos = tell $infile; $fileLocation =~ s/(.)/sprintf("%02x",ord($1))/eg; $fileSize =~ s/(.)/sprintf("%02x",ord($1))/eg; $fileName =~ s/\0+$//; open($file, '>', "extracted/$fileName") or die "Cannot open $fileName + $!"; binmode($file); sysseek ($infile, hex($fileLocation), 0); sysread ($infile, $chunk, hex($fileSize)); syswrite ($file, $chunk); $fileLocation = ''; $fileSize = ''; };

Replies are listed 'Best First'.
Re^3: problem with sysseek in loop
by james28909 (Deacon) on May 07, 2014 at 01:14 UTC
    or do you mean with get md5 too?