Re: reading a few bytes into a file

2008-07-30 Thread John W. Krahn
Rob Dixon wrote: use strict; use warnings; my $file = shift; open my $fh, '<', $file or die $!; print "Filename: $file"; my $buffer; my $count = read $fh, $buffer, 8 or die $!; die "Insufficient data in file" unless $count >= 8; my $dv = unpack '@4 N', $buffer; print " Value: $dv\n"; Or:

Re: reading a few bytes into a file

2008-07-30 Thread Rob Dixon
Scott Haneda wrote: > > Hi Rob, thanks for your reply. This is my first adventure into perl, > and I am a bit stumped. I have experience in a few web scripting > languages, but this is a little new to me. > > Your script does work, and returns a number, but not the correct one, > and I thi

Re: reading a few bytes into a file

2008-07-30 Thread Rob Dixon
Scott Haneda wrote: > Hello, I have this small C app that someone wrote for me ages ago, and > am tired of it breaking every time I move it around to various > systems, I will include it below. > > I am hoping I can do this in perl, as a one liner, were it will read a > the first 4 bytes of

Re: reading a few bytes into a file

2008-07-30 Thread Jenda Krynicky
From: Scott Haneda <[EMAIL PROTECTED]> > Hello, I have this small C app that someone wrote for me ages ago, and > am tired of it breaking every time I move it around to various > systems, I will include it below. > > I am hoping I can do this in perl, as a one liner, were it will read a > th