RE: Reading hex data from file.

2004-08-19 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi, > Among other data, a binary file contains the bytes "00A5". > I am trying to read these four bytes and get the decimal equivalent as > follows: [snip] > read(FD, $buf, 4); $buf -> "00A5" I'm not sure I follow. Are you saying the characters in buf are

RE: Reading hex data from file.

2004-08-19 Thread West, William M
>Hi, >Among other data, a binary file contains the bytes "00A5". >I am trying to read these four bytes and get the decimal equivalent as - $POST_DATA =~ s/(\w\w)/chr (hex($1))/eg; this is a line from one of my programs where i send data from another program in the form of argueme

Reading hex data from file.

2004-08-18 Thread PerlDiscuss - Perl Newsgroups and mailing lists
Hi, Among other data, a binary file contains the bytes "00A5". I am trying to read these four bytes and get the decimal equivalent as follows: .. $buf; $hex_val; $dec_val; read(FD, $buf, 4); $buf -> "00A5" $hex_val = unpack("H*", $buf); $dec_val = hex($hex_val); ... Is there a way in wh