Following is the code:

1.      open(FILE, "< $l_file") ||
2.              die "Unable to open data file ($l_file)";
3.          for ( ;; ) {
4.              $length = read(FILE,$block,2048);
5.              if ( !defined($length) || $length == 0 ) {
6.                  # Normal end of file
7.                  last;
8.              }
9.              elsif ( $length != 2048 ) {
10.                 # Unexpected end of file
11.                 print "WARNING: Invalid last block length
($length)\n";
12.             last;
13.         }
14.         $blockcnt++;
15.         print "BLOCK $blockcnt\n";
16.         $reccnt = 0;
17.         # The first 4 bytes are the block descriptor word of which
18.         # the first 2 bytes is the length of valid data in the block
19.         $length = unpack("n", $block);###
20.         if ( $length > 2048 ) {
21.             # Bad valid data in block length
22.             print "WARNING: Invalid valid data in block length
($length)\n";
23.             last;
24.         }

The Error Message: WARNING: Invalid valid data in block length (16412)

The same message appears both on Red Hat Linux 7 and Windows 2000
Advance Server.

Rafaqat Ali Chaudhary

-----Original Message-----
From: Rob Dixon [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 13, 2003 03:32
To: [EMAIL PROTECTED]
Subject: Re: Hex files manipulation problem


Rafaqat Ali Chaudhary wrote:
> Hi every body,
>
> I've got here a script which extracts event logs from Hexadecimal 
> files by parsing them for a certain pattern set. The script runs fine 
> on Solaris 8 (running on a SUN box) but fails on Linux or a Windows 
> box.

Hi.

Look at all that John mentioned, and then read

  perldoc -f binmode

The well-behaved systems around the world don't care
whether you're reading binary or text, but both Windows
and various Linux incarnations have oddities in this
area.

But please let us know more about your program, data
files and platforms, otherwise we can do little.

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to