CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Using bin mode

 



GoldenBoy
Novice

Nov 17, 2003, 6:47 PM

Post #1 of 4 (410 views)
Using bin mode Can't Post

Here is my code...


Code
use PerlIO; 
open($file, "<", sob19.exe);
binmode($file);
print $file;


Now the output is "GLOB(0x224eec)" how do I edit the binary from there? Thanks


davorg
Thaumaturge / Moderator

Nov 19, 2003, 2:25 AM

Post #2 of 4 (405 views)
Re: [GoldenBoy] Using bin mode [In reply to] Can't Post

There's no need to use PerlIO there. It's not adding anything useful.

You're getting the value "GLOB(0x224eec)" because you're printing the value of a filehandle. That's not a very useful thing to to. Generally it's a better idea to read data from a filehandle.


Code
open FILE, "<sob19.exe" or die $!; 
binmode FILE;

my $buffer;

while (my $size = read FILE, $buffer, 1024) {
# Now $buffer contains $size bytes of data
# (where size <= 1024) from FILE.
# Do what you want with it
}


--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


GoldenBoy
Novice

Nov 19, 2003, 1:36 PM

Post #3 of 4 (403 views)
Re: [GoldenBoy] Using bin mode [In reply to] Can't Post


Code
open SOB,"<sob19.exe" or die print "can't open"; 
binmode(SOB);
while(<SOB>) {
print $_;
}


It prints out all different symbols any way to get it to 10101? So I can change stuff?


davorg
Thaumaturge / Moderator

Nov 20, 2003, 1:42 AM

Post #4 of 4 (400 views)
Re: [GoldenBoy] Using bin mode [In reply to] Can't Post

"sprintf" or "unpack". As I mentioned to you last week.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives