Re: reading a few bytes into a file
- From: Jenda@xxxxxxxxxxx (Jenda Krynicky)
- Date: Wed, 30 Jul 2008 11:12:35 +0200
From: Scott Haneda <talklists@xxxxxxxxxx>
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 a file, grab 4 bytes out of the file, which is a
big endian value, and return that as an int to me.
perldoc -f read
perldoc -f unpack
perldoc -f pack
And to simplify the code (so that you do not need to explicitely open
the file), look also into
perldoc perlvar
at the ARGV filehandle.
HTH, Jenda
===== Jenda@xxxxxxxxxxx === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
.
- References:
- reading a few bytes into a file
- From: Scott Haneda
- reading a few bytes into a file
- Prev by Date: Re: getting process id under NT
- Next by Date: How to get a computed string to act as a re in if statement
- Previous by thread: reading a few bytes into a file
- Next by thread: Re: reading a few bytes into a file
- Index(es):
Relevant Pages
|