Results 1 to 2 of 2

Thread: Bit stream (perl question)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Location
    Earth
    Posts
    27

    Bit stream (perl question)

    Hey there,

    I have a program which opens bitmap files and prints the content to screen, the code is below...

    Code:
    #!c:/Perl/bin/Perl.exe
    
    print "Content-type: text/html\n\n";
    print "Read a bitmap\n\n";
    
    open (file, "try.bmp") || die("This file could not be opened");
    binmode(file,":raw");
    while(<file>){
    $string .= $_;
    
    }
    close(file);
    
    print $string;
    print "\nBitmap read";
    The next stage is to have the output as the bit stream as I am opening monochrone bitmaps which I believe from the documentation I have read is a 0 and 1, x by y grid with a 54 byte header, I have tried using sprinf("%b", $string); and various other method but to no avail.

    Any help on this matter would be great, thank you.

  2. #2
    Member
    Join Date
    Jan 2003
    Posts
    44
    unpack 'B*', $string;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width