Hi All, I have an issue with a Perl script designed to count pages in a TIFF file on AIX.
The result I get depends on the location of the TIFF file when I count it. Specifically, when the TIFF file resides on a "JFS2" file system or a "JFS" file system which has large file support (> 2Gb) enabled, the seek works, otherwise the seek fails. Obviously this impacts on the correctness of the page count reported. Code snippet and sample output follows: ----- ## open the file for reading. open (FIN, $_[0]) || die "couldn't open the file! $_[0]"; ## read the 8 header bytes (3 fields), and unpack the mode ## to determine byte order (endian) read FIN, $record, 8; ($mode) = unpack "A2", $record; if ($mode eq "MM") { # big endian $header_template = "A2nN"; $idf_tag_template = "n"; $next_offset_template = "N"; } elsif ( $mode eq "II" ) { # little endian $header_template = "A2SL"; $idf_tag_template = "S"; $next_offset_template = "L"; } else { die "invalid file format or not a TIFF file ($_[0])"; } ## unpack the header ($mode, $magic, $offset) = unpack $header_template, $record; print "\n(1) mode:$mode, magic:$magic, offset:$offset\n"; ## count the pages (images) while ( $offset ) { $page_count++; ## Move the file pointer to the beginning of the first IDF, ## read the number of entries in the IDF, and unpack the number print "\nSeek to IDF at offset $offset\n"; my $seek_ok = seek(FIN, $offset, 0); if ($seek_ok == 0) { print "Seek for IDF failed: $!\n"; } else { print "Seek OK!\n"; } ... <snip> ... } ------ Sample output from *NON* JFS file system: (1) mode:II, magic:10752, offset:3556769792 Seek to IDF at offset 3556769792 Seek for IDF failed: A system call received a parameter that is not valid. ------ Sample output from JFS file system: (1) mode:II, magic:10752, offset:3556769792 Seek to IDF at offset 3556769792 Seek OK! I have tried using binmode() but that makes no difference. Has anyone else encountered anything like this? If so, how did you resolve it? Regards, Ashley ************************************************************************************* This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more information, visit our website at www.salmat.com.au. ************************************************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>