Re: how to use perl compare 2 binary files?

2008-11-23 Thread John W. Krahn
loody wrote: Dear all: Hello, I try to use perl to compare 2 binary files, one is display content dump from Dram and another is display content calculated by my c-model code. I use open and binmode to open these 2 files, and use programs as below to do the comparison

how to use perl compare 2 binary files?

2008-11-22 Thread loody
Dear all: I try to use perl to compare 2 binary files, one is display content dump from Dram and another is display content calculated by my c-model code. I use open and binmode to open these 2 files, and use programs as below to do the comparison: $num_pattern=read PATTERN, $tmp_gold

Re: how to use perl compare 2 binary files?

2008-11-22 Thread loody
Does that mean I should use ne instead of !=? BTW, is there any faster default function provide by Perl library to compare 2 binary files? thanks for your help, miloody -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: how to use perl compare 2 binary files?

2008-11-22 Thread Rodrick Brown
Check using a hash of the binary using something like MD5::Digest or something. On Sat, Nov 22, 2008 at 11:49 PM, loody [EMAIL PROTECTED] wrote: Does that mean I should use ne instead of !=? BTW, is there any faster default function provide by Perl library to compare 2 binary files? thanks

Re: how to use perl compare 2 binary files?

2008-11-22 Thread loody
2008/11/23 loody [EMAIL PROTECTED]: Does that mean I should use ne instead of !=? BTW, is there any faster default function provide by Perl library to compare 2 binary files? thanks for your help, Hi: forget to explain my question more specifically. I need to compare 2 YUV format image files

Replace first 2 bytes on binary files?

2008-10-05 Thread Louise Hoffman
Dear programmers I am new to Perl, and was wondering, if someone could help me? I would like to replace the first 2 bytes from ## to BM in all the files in a directory. The files are binary. Can that be done easily in Perl? Hope to hear from you =) Lots of love, Louise -- To unsubscribe,

Re: Replace first 2 bytes on binary files?

2008-10-05 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 04:44 -0700, Louise Hoffman wrote: Dear programmers I am new to Perl, and was wondering, if someone could help me? I would like to replace the first 2 bytes from ## to BM in all the files in a directory. The files are binary. Can that be done easily in Perl? Yes.

Re: Replace first 2 bytes on binary files?

2008-10-05 Thread Dr.Ruud
Mr. Shawn H. Corey schreef: Louise Hoffman: I would like to replace the first 2 bytes from ## to BM in all the files in a directory. The files are binary. Use glob to get the list of files. Use open with read-write to read the first line and replace the bytes. I wouldn't read a line,

Re: Replace first 2 bytes on binary files?

2008-10-05 Thread John W. Krahn
Dr.Ruud wrote: Mr. Shawn H. Corey schreef: Louise Hoffman: I would like to replace the first 2 bytes from ## to BM in all the files in a directory. The files are binary. Use glob to get the list of files. Use open with read-write to read the first line and replace the bytes. I wouldn't

Re: Replace first 2 bytes on binary files?

2008-10-05 Thread Dr.Ruud
John W. Krahn schreef: Dr.Ruud: Mr. Shawn H. Corey: Louise Hoffman: I would like to replace the first 2 bytes from ## to BM in all the files in a directory. The files are binary. Use glob to get the list of files. Use open with read-write to read the first line and replace the bytes.

Re: Reading binary files in Perl

2004-05-06 Thread John W. Krahn
Paul Harwood wrote: I am trying to read a binary file with the following code: $filename = binary_file.rpy; open(FILE, $filename) or die can't open $filename: $!; binmode(FILE); binmode(STDOUT); while (read(FILE, $buff, 8 * 2**10)) { print STDOUT $buff; } I get

binary files

2003-02-13 Thread Sugrue, Sean
I need to be able read the first few lines of a binary test file (i.e. .staff form). Does anyone know how to do this in purl. Sean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: binary files

2003-02-13 Thread Janek Schleicher
On Thu, 13 Feb 2003 11:49:04 -0500, Sean Sugrue wrote: I need to be able read the first few lines of a binary test file (i.e. .staff form). Please define what is a line for you in a binary file. If it is just a normal line (ending on the line separator), you just can do the normal way, e.g.

how to read binary files in perl

2003-01-29 Thread HK
hi all, i am a newbie to perl. I have an application in C which will dump statistics (C structures) into log files for post processing. Can i read those log files from perl and form equivalent structures which will help in analysing the files and generate a report on the statistics. TIA. --

Re: how to read binary files in perl

2003-01-29 Thread Paul Johnson
HK said: hi all, i am a newbie to perl. I have an application in C which will dump statistics (C structures) into log files for post processing. Can i read those log files from perl and form equivalent structures which will help in analysing the files and generate a report on the

Re: Perl Unix Binary Files

2002-11-06 Thread John Pitchko
All e-mails and attachments are certified virus free! - Original Message - From: Jim [EMAIL PROTECTED] To: John Pitchko [EMAIL PROTECTED]; Paul Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 1:06 AM Subject: Re: Perl Unix Binary Files On Sunday 03

Re: Perl Unix Binary Files

2002-11-05 Thread Jim
PROTECTED] | To: Paul Johnson [EMAIL PROTECTED] | Cc: [EMAIL PROTECTED] | Sent: Sunday, November 03, 2002 10:31 AM | Subject: Re: Perl Unix Binary Files | | On Saturday 02 November 2002 18:01, you wrote: | | On Sat, Nov 02, 2002 at 04:00:44PM -0600, John Pitchko wrote: | | I've been racking my

Re: Perl Unix Binary Files

2002-11-03 Thread zentara
On Sat, 2 Nov 2002 16:00:44 -0600, [EMAIL PROTECTED] (John Pitchko) wrote: Hi all. I've been racking my brains out trying to get Perl to write binary files for me. Here is my situation. For my I was thinking that I would record the output from Data::Dumper into a scalar and write this scalar

Re: Perl Unix Binary Files

2002-11-03 Thread Jim
On Saturday 02 November 2002 18:01, you wrote: | On Sat, Nov 02, 2002 at 04:00:44PM -0600, John Pitchko wrote: | I've been racking my brains out trying to get Perl to write binary | files for me. Here is my situation. For my Operating Systems class, we | are designing a file system. One

Re: Perl Unix Binary Files

2002-11-03 Thread John Pitchko
virus free! - Original Message - From: Jim [EMAIL PROTECTED] To: Paul Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 03, 2002 10:31 AM Subject: Re: Perl Unix Binary Files On Saturday 02 November 2002 18:01, you wrote: | On Sat, Nov 02, 2002 at 04:00:44PM -0600, John

Perl Unix Binary Files

2002-11-02 Thread John Pitchko
Hi all. I've been racking my brains out trying to get Perl to write binary files for me. Here is my situation. For my Operating Systems class, we are designing a file system. One of the requirements is that the file system needs to be saved to disk as a binary file. I have a few large array

Re: Perl Unix Binary Files

2002-11-02 Thread Paul Johnson
On Sat, Nov 02, 2002 at 04:00:44PM -0600, John Pitchko wrote: I've been racking my brains out trying to get Perl to write binary files for me. Here is my situation. For my Operating Systems class, we are designing a file system. One of the requirements is that the file system needs

How to check between text binary files

2002-10-14 Thread George P.
Hi, I want to write a .pl that will take in filenames as parameters, and print out whether the files are text files or binary files. The problem I'm having is that I can't figure out a good rule to use while deciding whether a file is a text-file or a binary-file. If someone has created

RE: How to check between text binary files

2002-10-14 Thread Toby Stuart
2:53 PM To: [EMAIL PROTECTED] Subject: How to check between text binary files Hi, I want to write a .pl that will take in filenames as parameters, and print out whether the files are text files or binary files. The problem I'm having is that I can't figure out a good rule to use

Re: binary files

2002-06-08 Thread Felix Geerinckx
on Fri, 07 Jun 2002 23:28:44 GMT, Eric Abell wrote: My question is this: what is the difference between c and C? I know what perldoc says - one is a signed char and the other is an unsigned char. So if I have the value 230, shouldn't that be illegal for a signed 8-bit number, since the valid

binary files

2002-06-07 Thread Eric Abell
I have an application that requires me to write normal string data or a number into a binary file. For example, if I have the string ff, I want to write the byte FF to the output file. If I have the number 1, I want to write the byte 01 to the output file. I have been using the pack function

Re: binary files

2002-06-07 Thread John W. Krahn
Eric Abell wrote: I have an application that requires me to write normal string data or a number into a binary file. For example, if I have the string ff, I want to write the byte FF to the output file. print chr(hex(ff)); If I have the number 1, I want to write the byte 01 to the output

binary files

2001-08-15 Thread Tyler Cruickshank
Hello. Im still struggling with converting a binary file to an ascii file. I just dont understand how to use seek and unpack. I understand that one needs to know the format of the binary file, therefore, I have pasted below FORTRAN code that reads the ascii file and writes a binary file.

Re: binary files

2001-08-15 Thread Peter Scott
At 04:58 PM 8/15/01 -0600, Tyler Cruickshank wrote: Hello. Im still struggling with converting a binary file to an ascii file. I just dont understand how to use seek and unpack. I understand that one needs to know the format of the binary file, therefore, I have pasted below FORTRAN code

binary files

2001-07-31 Thread Tyler Cruickshank
Hello. Looking for some binary file help. I want to read, manipulate, and print (in ascii) a binary file on a solaris 7 machine. I have looked into and tried the binmode() function but this seems to be for older machines that differentiate between ascii and binary files. I have tried

RE: binary files

2001-07-31 Thread Bob Showalter
-Original Message- From: Tyler Cruickshank [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 1:32 PM To: [EMAIL PROTECTED] Subject: binary files Hello. Looking for some binary file help. I want to read, manipulate, and print (in ascii) a binary file on a solaris 7

Re: binary files

2001-07-31 Thread Michael Fowler
that differentiate between ascii and binary files. I have tried the following and just get the binary form printed back out at me (the expected result): binmode() is indeed for operating systems that differentiate between ascii and binary, but such operating systems are not old. Even the newest versions

Re: binary files

2001-07-31 Thread Luke Bakken
To read binary files, you need to understand read(), seek() and unpack(), as well as the underlying binary structure of the file. Peeking into the file with a hex editor will help distinguish the ASCII bits from the rest. If you know the C code that creates the file, that can help a lot! Luke

Reading binary files

2001-07-26 Thread Sambamoorthy Jayaraman
Hi, How do I read a binary file?? From this file, I need to read 16 bit values. I have attached a sample binary file alongwith. When you are reading this file, enable `hex edit mode'. Any help will be deeply appreciated. Regards, Samba

Re: Reading binary files

2001-07-26 Thread Maxim Berlin
Hello Sambamoorthy, Thursday, July 26, 2001, Sambamoorthy Jayaraman [EMAIL PROTECTED] wrote: SJ How do I read a binary file?? From this file, I need to read 16 bit values. SJ I have attached a sample binary file alongwith. When you are reading this SJ file, enable `hex edit mode'. perldoc -f

RE: Reading binary files

2001-07-26 Thread Bob Showalter
-Original Message- From: Sambamoorthy Jayaraman [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 2:32 AM To: [EMAIL PROTECTED] Subject: Reading binary files Hi, How do I read a binary file?? From this file, I need to read 16 bit values. I have attached a sample