Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!portal!sv!daven From: daven@svc.portal.com Newsgroups: comp.sys.mac.programmer Subject: Re: stdio, THINK C and APPLs Message-ID: <1990Dec24.182548.17958@svc.portal.com> Date: 24 Dec 90 18:25:48 GMT References: Organization: Software Ventures Lines: 27 In article vladimir@prosper.EBB.Eng.Sun.COM (Vladimir G. Ivanovic) writes: >As far as I can tell, THINK C's implementation of stdio will not read anything >from a file of type APPL. I've tried opening an application with both fopen() >with "r" and "rb", and with open() with O_BINARY (the default) without >success. No errors are returned by any call, just 0 bytes are read. > >Is my assumption that since there is no data fork, stdio thinks it's has a >zero length file correct? Or am I doing something wrong? Does that mean I >have to use Toolbox calls to copy an application? Bingo! There's no data fork, so there's no data to read. >If the data fork assumption is correct, is this The Way It Should Be? How >does MPW C behave? This is The Way It Should Be! Imagine if everytime you used fopen() it returned to you the contents of a) the data fork, or b) the resource fork, or c) both. You'd have no way of knowing what you'd get. Instead, it was decided that only the data fork contents would be read. If you want to get to the resource fork, you'll have to make Mac file system calls. -- ------------------------------------------------------------------------------- Dave Newman | daven@svc.portal.com | AppleLink: D0025 Sofware Ventures Corp. | AOL: MicroPhone | CIS: 76004,2161 Berkeley, CA 94705 | WELL: tinman@well.sf.ca.us | (415) 644-3232