In a message dated 11/7/2005 1:17:44 P.M. Eastern Standard Time, [EMAIL PROTECTED] writes:
 
> I got the following problem using Active Perl:

> I need to read a file that is HEXA encoded. I whant to see (when do a print command)
> the HEXA values, like 8D and etc...
> Do you know how to open and manage a file in hexa?

> All the time that I tried Perl try to convert this to ASCII or UTF-8 encoding...

> ...
> binmode(FILE);
 
use binmode() on a file handle only AFTER the file is opened, not before.  
 
> $file_name= $ARGV[0];
> open(FILE,$file_name)
>  || die "could not open Source file\n";
 
    binmode(FILE);  # if needed -- but is it really needed here?  
 

> while(<FILE>)
>  {
> chomp;
>                           #
>   @linha = split(/8D/);   # A partir desse momento $linha[0] vale a primeira linha
>                           #
> ...

> The idea is to split all the sorce file when found the 80h value.
 
alexandre --  
 
i see two problems with the code above.   one, with the binmode() function, is already noted.    the other is that i do not understand what the HEXA format is.   if this is the intel hex file format (e.g., records like ``:10010000214601360121470136007EFE09D2190140<cr>''), then the pack/unpack perl functions will very nicely decode/encode these records.   if HEXA is something else, please give a link to some web reference defining it (in english, please; my spanish is very poor) and i or someone else may be able to help.  
 
best regards -- bill walters  
 
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to