[comp.sys.mac.programmer] BusError in SFGetFile with my DLOG resource. help!

johnsone@uxh.cso.uiuc.edu (Erik A. Johnson) (04/17/91)

Help!  I've tried using my own Dialog resources for SFGetFile (in order to
add a prompt string to the standard SFGetFile dialog), but the second or
third time I try to open a file from within my application, either one of
two things happen:  an (apparent) infinite loop, or a Bus Error.  Both these
nasties happen within the StripAddress() function (as described in IM-V-p593).

It happens whether I use SFGetFile with the proper DLOG resource #-4000
or use SFPGetFile with a DLOG resource ID of my choice.

Any ideas?  I'll tack on a small segment of my code after the .sig.

E-mail responses and I'll post back to c.s.m.p.  Thanks much in advance.


Erik A. Johnson, Graduate Student        \ Internet:  johnsone@uxh.cso.uiuc.edu
Aeronautical & Astronautical Engineering  \
University of Illinois at Urbana-Champaign \ AmericaOnline: ErikAJ


-------------------------- cut here ---------------------------------

#define NO_FILTER_PROC      0L
#define NIL_PROCPTR         0L
#define DIALOG_ID           128
   SFTypeList   myTypes;
   SFReply      aReply;
   Point        sfgWhere = { 40, 82 };
   int          numTypes;
    
        numTypes = 1;
        myTypes[0] = 'TEXT';
        aReply.good = FALSE;
        
        /* option 1:
         * SFGetFile( sfgWhere, (StringPtr)"\p", NO_FILTER_PROC, numTypes,
         *            &myTypes, NIL_PROCPTR, &aReply );
         */
        
        /* option 2: */
        SFPGetFile( sfgWhere, (StringPtr)"\p", NO_FILTER_PROC, numTypes,
                    &myTypes, NIL_PROCPTR, &aReply,
                    DIALOG_ID, NO_FILTER_PROC );
        
        if (aReply.good)
            MyOpenFile( aReply.vRefNum, aReply.fName );