In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Doug McNutt) wrote:
> The cat operation creates a text file with "foo" in the data, and only, fork. > > Rich's problem is "opening" Icon\r files which are surely from Classic icon > resource files zB (using MPW on a 9.1 box): Yes, but he also was asking generally of how to handle files with the CR in them. And I was just making the point that it is not OS-specific, and you can use nulls or sysopen. Actually, I think there is another good way, too: $ perl -e 'open $fh, "<", "Icon\r" or die $!' Yeah, three-arg open, which doesn't have the "magic" of two-arg open. But yes, to get the actual data, you need the resource fork, using either Mac::Resources or similar, or opening namedfork/rsrc/: $ perl -e 'open $fh, "<", "Icon\r/..namedfork/rsrc" or die $!' > If 'Icon'n'' is opened in perl in OS neXt, will perl read from the resource > fork if there is no data fork? Or will it fail to open? This isn't specific to Mac OS X, it is handled by the OS. open() and friends always open the data fork, unless passed a ..namedfork sort of thing (or unless you use POSIX open with the O_RSRC flag, which works on Mac OS, but NOT on Mac OS X, which is kinda weird, as it seems like it would be of use). It will succeed on the open, but there will be no data. -- Chris Nandor [EMAIL PROTECTED] http://pudge.net/ Open Source Development Network [EMAIL PROTECTED] http://osdn.com/