[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Merge data and resource fork



On Thu, 13 Jul 2000 23:17:54 +0200, René Laterveer wrote:

>After Paul Schinder's remark I looked at POSIX::Open and came up with the
>following code.
...
># Merge the data fork of one file and resource fork of another file

It looks like you're working too hard. If all you want is copy the
resource fork of one file, and the data fork of another file, all you
need to do is copy the file containing the resource fork, and copy the
data fork to it using ordinary primitives. Untested code (and don't
forget to assign values to the variables):

	use File::Copy;
	copy $RsrcFile, $NewFile;
	open IN, $DataFile;
	binmode IN;  # a good habit
	open OUT, ">$NewFile";
	binmode OUT;
	while(read IN, $_, 8192) {
	    print OUT;
	}

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org