Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!ndcheg!ndmath!dierks From: dierks@ndmath.UUCP (Tim Dierks) Newsgroups: comp.sys.mac.hypercard Subject: Re: opening files from an XCMD Message-ID: <1364@ndmath.UUCP> Date: 22 Apr 89 04:18:00 GMT References: <7057@hoptoad.uucp> Organization: Math. Dept., Univ. of Notre Dame Lines: 26 From article <7057@hoptoad.uucp>, by tim@hoptoad.uucp (Tim Maroney): > In article <7929@june.cs.washington.edu> moore@june.cs.washington.edu (Charles Moore) writes: >>Is there any problem with accessing files from an XCMD? I'm trying to >>write an XCMD that opens and reads from an existing file and creates and >>writes to another file. Substantially similar code works fine as a >>stand-alone application but my attempts at opening either of these files >>from within my XCMD always fail. Does anybody know why this might be? >>I'm writing my XCMD in Lightspeed C and am using the standard C file I/O >>functions fopen(), fscanf(), and fprintf(). > The standard C I/O system requires access to its globals and very [...] > be unable to use fscanf and fprintf. sscanf and sprintf may work > instead, and you can then easily bring their buffers to or from the > file with FSRead and FSWrite. Please correct me if I'm wrong, but I believe that all you have to do to use any of LSC's libraries in a code resource (anything that doesn't have its globals hanging off of A5) by opening up the project you want to include (stdio, whatever) changing its type to anyting but Application, and recompiling all the files. Now its globals hang off of A4. If you set up A4 correctly (as described in the manual) you're set. For more information, see pages 84-5 of your LSC manual (version 3.0). Tim Dierks dierks@darwin.cc.nd.edu