Loading ...
Sorry, an error occurred while loading the content.
 

Binmode

Expand Messages
  • Gilles Beauregard
    Hello! I have to copy some images on my Windows system with Perl. I use the following script to do so: $in_ = original.gif ; open (IN, $in_ ) ; @fichier=
    Message 1 of 2 , Dec 14, 2007
      Hello!

      I have to copy some images on my Windows system with Perl.

      I use the following script to do so:

      $in_ = "original.gif" ;

      open (IN,"$in_") ;
      @fichier=<IN> ;
      close (IN) ;

      $out = "destination.gif" ;

      open (OUT,">$out") ;
      binmode OUT, ":raw" ;
      print OUT @fichier ;
      close (OUT) ;

      Some images are copy whithout problem, but some others are
      corrupt, some byte is missing.

      I can't figure the reason of that behavior.

      Any help are welcome.

      Gilles B.







      ---
      Webmasters helping webmasters
      http://www.balour.org/
    • jabir ahmed
      use File::Copy or try to binmode(FILE_HANDLE) This function puts FILE_HANDLE into a binary mode. http://www.schogini.com/articles/File-Functions.html ... -- If
      Message 2 of 2 , Dec 14, 2007
        use File::Copy
        or
        try to

        binmode(FILE_HANDLE) This function puts FILE_HANDLE into a binary mode.

        http://www.schogini.com/articles/File-Functions.html

        On Dec 14, 2007 11:14 PM, Gilles Beauregard <gilles@...> wrote:

        > Hello!
        >
        > I have to copy some images on my Windows system with Perl.
        >
        > I use the following script to do so:
        >
        > $in_ = "original.gif" ;
        >
        > open (IN,"$in_") ;
        > @fichier=<IN> ;
        > close (IN) ;
        >
        > $out = "destination.gif" ;
        >
        > open (OUT,">$out") ;
        > binmode OUT, ":raw" ;
        > print OUT @fichier ;
        > close (OUT) ;
        >
        > Some images are copy whithout problem, but some others are
        > corrupt, some byte is missing.
        >
        > I can't figure the reason of that behavior.
        >
        > Any help are welcome.
        >
        > Gilles B.
        >
        > ---
        > Webmasters helping webmasters
        > http://www.balour.org/
        >
        >



        --
        If you haven't found something you are willing to die for, you are not
        fit to live!
        --
        Phone: +91 9980799008
        email: jabirahmed@... , jabirahmed@...
        Instant Messenger:
        yahoo jabirahmed@...,msn : jabir07@...,ICQ: 56327312, Skype:
        jabirahmed


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.