smanicka has asked for the wisdom of the Perl Monks concerning the following question:
What does the 65536 indicate here? i got this off some site and am trying to understand how this works since i need to write a similar function to copy using bin mode. Update:I actually want to make this code to copy files in binary mode.Any ideas to help me on my mission?#!/usr/bin/perl # copy a file $in = "postcodes"; $out = "pc.bak"; open (IN,$in); open (OUT,">$out"); print OUT $buffer while (read (IN,$buffer,65536));
File::copy says that file would be opened in bin mode where applicable.The issue is that the font files that I am trying to copy are often not copied properly and the copied files are smaller than the original file.#!usr/bin/perl use strict; use File::Find; use File::Copy; my @location=("C:\\Documents and Settings\\smanicka\\Desktop\\JAVA","C +:\\Documents and Settings\\smanicka\\Desktop\\excel files-new"); my $new_location="C:\\moved_files"; foreach my $location(@location){ find(\&force_move,$location); } sub force_move(){ my $file=$_; print "\n $file"; copy($file,$new_location) or warn "$!" ; } print "I am done!!!!"; sleep(2);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bin mode file copy
by Corion (Patriarch) on Mar 16, 2009 at 15:56 UTC | |
|
Re: bin mode file copy
by Bloodnok (Vicar) on Mar 16, 2009 at 16:09 UTC | |
by ikegami (Patriarch) on Mar 16, 2009 at 16:48 UTC | |
|
Re: bin mode file copy
by ikegami (Patriarch) on Mar 16, 2009 at 20:40 UTC | |
|
Re: bin mode file copy
by kennethk (Abbot) on Mar 16, 2009 at 15:58 UTC | |
|
Re: bin mode file copy
by locked_user sundialsvc4 (Abbot) on Mar 16, 2009 at 16:44 UTC | |
by ikegami (Patriarch) on Mar 16, 2009 at 16:58 UTC | |
|
Re: bin mode file copy
by Marshall (Canon) on Mar 16, 2009 at 19:25 UTC | |
by almut (Canon) on Mar 16, 2009 at 20:22 UTC | |
|
Re: bin mode file copy
by Marshall (Canon) on Mar 19, 2009 at 00:58 UTC |