[comp.sys.mac.programmer] How to set EOF of "resource" file to 0?

gft_robert@gsbacd.uchicago.edu (05/03/90)

I have an app with two kinds of files: "data" files, manipulated with FS file
calls, and "resource" files, which contain only a resource fork and are thus
manipulated using Resource Manager calls.

When a user wants to overwrite a "data" file (that is, in SFPutFile they've
indicated that they wish to make a new file with same name as an old one), I
just open it and then SetEOF to 0.  But how do I do it for the "resource"
files?  Do I use OpenRF and then call SetEOF to set the EOF to 0, or do I
actually have to use the Resource Manager to delete every resource?

Robert
      
============================================================================
= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
=            		         * all my opinions are *  compute"         =
=                                * mine                *  -Kraftwerk       =
============================================================================

beard@ux1.lbl.gov (Patrick C Beard) (05/04/90)

In article <9084@tank.uchicago.edu> gft_robert@gsbacd.uchicago.edu writes:
#When a user wants to overwrite a "data" file (that is, in SFPutFile they've
#indicated that they wish to make a new file with same name as an old one), I
#just open it and then SetEOF to 0.  But how do I do it for the "resource"
#files?  Do I use OpenRF and then call SetEOF to set the EOF to 0, or do I
#actually have to use the Resource Manager to delete every resource?

You said it, use OpenRF, and SetEOF of that to 0.  That has always worked
for me.  If you don't the Resource fork will still contain the old 
resource map I believe.

-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------

bochner@speed.harvard.EDU (Harry Bochner) (05/04/90)

In article <5544@helios.ee.lbl.gov>, beard@ux1.lbl.gov (Patrick C Beard)
writes:

|>You said it, use OpenRF, and SetEOF of that to 0.  That has always worked
|>for me.  If you don't the Resource fork will still contain the old 
|>resource map I believe.

At this point you no longer have a resource map, and so I don't think the
Resource Manager will open it. I think that after the SetEOF you need do
the call
(I don't remember the name) to create a new resource fork.
               
Harry Bochner
bochner@endor.harvard.edu