develooper Front page | perl.macperl.toolbox | Postings from March 2003

Re: [MacPerl-Toolbox] strip the resource fork

Thread Previous | Thread Next
From:
Chris Nandor
Date:
March 21, 2003 15:12
Subject:
Re: [MacPerl-Toolbox] strip the resource fork
Message ID:
p05200f05baa14be6d060@[10.0.1.104]
http://archive.develooper.com/macperl@perl.org/msg02178.html

>Here's another way, if you really want to destroy it and avoid copying:
>
>	use Fcntl ();
>	use POSIX ();
>
>	my $resfork = POSIX::open($file,
>		&POSIX::O_WRONLY | &POSIX::O_TRUNC | &Fcntl::O_RSRC
>	);
>	POSIX::close($resfork);
>
>This will truncate the resource fork to size 0, which essentially deletes it.

Without testing, I am fairly certain the fork will be gone.  You can test
by attempting to open the file in ResEdit to see if it asks if you want to
create a new resource fork for the file.

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About