my gif's won't work after copying them 
Author Message
 my gif's won't work after copying them

[mailed and posted]


: Hello everybody,

: I have a problem. Well, actually I have more than one, but the others are
: not appropriate for this newsgroup. This is the case:
: I want to copy a gif file from one directory to an other. As I am not
: aware of a command for this operation in Perl I used the following
: workaround:

: open (PLAATJEDEF ,">$filenaam") || die "plaatjedef niet aan te maken";
: open (PLAATJE ,"$plaatje") || die "plaatje niet te lezen";
binmode(PLAATJE);
binmode(PLAATJEDEF);
: while (<PLAATJE>) {
: print PLAATJEDEF;
: }

: $filenaam is the place I want to copy to and $plaatje is the path of the
: original gif-file. I thought this should work, and it does, but
: graphic-programs say that the file is not in the correct format. Tried it
: multiple times with different files. Still it does not copy correct.

: I work under dos, with bigperl (maybe I did not install it correct?).
: Anyway I would appreciate some help.

Add the two binmode calls above and you will be OK.  Without them,
the files are being read and written in text mode, which does
funny stuff with CR-LF pairs and EOF markers.

They have no effect on UNIX, so you can leave them there if porting
to another OS.

: P.S.: does anybody know if there is in perl something like the
: clear-screen command (cls) under dos?

You can use:

        system("command -c cls");

Regards,
--
Mike Heins                                                    ___       ___
                                    Internet Robotics        |_ _|____ |_ _|
Few blame themselves until they     131 Willow Lane, Floor 2  | ||  _ \ | |
have exhausted all other            Oxford, OH  45056         | || |_) || |
possibilities.                                               |___|  _ <|___|



Thu, 25 Jun 1998 03:00:00 GMT  
 my gif's won't work after copying them
Hello everybody,

I have a problem. Well, actually I have more than one, but the others are
not appropriate for this newsgroup. This is the case:
I want to copy a gif file from one directory to an other. As I am not
aware of a command for this operation in Perl I used the following
workaround:

open (PLAATJEDEF ,">$filenaam") || die "plaatjedef niet aan te maken";
open (PLAATJE ,"$plaatje") || die "plaatje niet te lezen";
while (<PLAATJE>) {
print PLAATJEDEF;

Quote:
}

$filenaam is the place I want to copy to and $plaatje is the path of the
original gif-file. I thought this should work, and it does, but
graphic-programs say that the file is not in the correct format. Tried it
multiple times with different files. Still it does not copy correct.

I work under dos, with bigperl (maybe I did not install it correct?).
Anyway I would appreciate some help.

Thanks,

Edward

P.S.: does anybody know if there is in perl something like the
clear-screen command (cls) under dos?

\ /      Hallo hier holland  

=:=      Homepage:http://www.iaehv.nl/users/lvgeuns/



Thu, 25 Jun 1998 03:00:00 GMT  
 my gif's won't work after copying them

[Posted && CC:'d]

+ $filenaam is the place I want to copy to and $plaatje is the path of the
+ original gif-file. I thought this should work, and it does, but
+ graphic-programs say that the file is not in the correct format. Tried it
+ multiple times with different files. Still it does not copy correct.

+ I work under dos, with bigperl (maybe I did not install it correct?).
+ Anyway I would appreciate some help.

Take a look at this (from the perl5 man page):

          binmode FILEHANDLE
                  Arranges for the file to be read or written in
                  "binary" mode in operating systems that distinguish
                  between binary and text files.  Files that are not
                  in binary mode have CR LF sequences translated to LF
                  on input and LF translated to CR LF on output.
                  Binmode has no effect under Unix; in DOS, it may be
                  imperative.  If FILEHANDLE is an expression, the
                  value is taken as the name of the filehandle.

If memory serves, DOS makes the distinction.

James

--
#!/bin/perl -s-- -export-a-crypto-system-sig -RSA-3-lines-PERL
$m=unpack(H.$w,$m."\0"x$w),$_=`echo "16do$w 2+4Oi0$d*-^1[d2%Sa
2/d0<X+d*La1=z\U$n%0]SX$k"[$m*]\EszlXx++p|dc`,s/^.|\W//g,print
pack('H*',$_)while read(STDIN,$m,($w=2*$d-1+length($n)&~1)/2)



Thu, 25 Jun 1998 03:00:00 GMT  
 my gif's won't work after copying them

Quote:

>Hello everybody,

>I have a problem. Well, actually I have more than one, but the others are
>not appropriate for this newsgroup. This is the case:
>I want to copy a gif file from one directory to an other. As I am not
>aware of a command for this operation in Perl I used the following
>workaround:

>open (PLAATJEDEF ,">$filenaam") || die "plaatjedef niet aan te maken";
>open (PLAATJE ,"$plaatje") || die "plaatje niet te lezen";
>while (<PLAATJE>) {
>print PLAATJEDEF;
>}

>$filenaam is the place I want to copy to and $plaatje is the path of the
>original gif-file. I thought this should work, and it does, but
>graphic-programs say that the file is not in the correct format. Tried it
>multiple times with different files. Still it does not copy correct.

>I work under dos, with bigperl (maybe I did not install it correct?).
>Anyway I would appreciate some help.

This happens because you are using ascii mode to read the file.. try
something like this (not tested, I think it will work but it could be alot
more efficient):

open (PLAATJEDEF ,">$filenaam") || die "plaatjedef niet aan te maken";
open (PLAATJE ,"$plaatje") || die "plaatje niet te lezen";
binmode(PLAATJEDEF);
binmode(PLAATJE);
while(sysread(PLAATJE, $blah, 1)) {syswrite(PLAATJEDEF,$blah, 1);}
close(PLAATJEDEF);
close(PLAATJE);



Sun, 28 Jun 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. can't copy gif file on NT?

2. animated gif won't blink

3. animated gif won't blink

4. Perl code that won't work with Embperl

5. www- why won't this work?!

6. Majordomo won't work with OSF/1 2.0

7. help? my cgi script won't work

8. regex --- why won't this work?

9. ??Redirect Script Won't Work With Win95???

10. Why won't this script work???

11. Reformated Why won't this work.

12. Why won't my for loop work?

 

 
Powered by phpBB® Forum Software