I would say that the first step is to find the length in bytes of the raw data block represented by 'i i f f f' (remembering that the data sizes of these template specifiers are implementation dependent).
Knowing the size of a single raw block allows reading n raw blocks of data at a time with, IIRC, read or sysread (or the appropriate buffered-read built-in) and then unpack-ing with a template like "($template)n" or just "($template)*".c:\@Work\Perl>perl -wMstrict -le "my $template = 'i2 f3'; ;; sub template_len { my ($template) = @_; ;; my $s = pack $template; return length $s; } ;; my $buf_size = template_len($template); print $buf_size; ;; print template_len('i i f f f'); print template_len('i f3 i'); " 20 20 20
In reply to Re: Iteratively unpack structure from binary file
by AnomalousMonk
in thread Iteratively unpack structure from binary file
by cMonkE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |