🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.acorn.tech
Article #709

Help with C programming

#709
From: TMOTA
Date: Sat, 19 Dec 1992 05:16
38 lines
1664 bytes
>>	What the best method of getting hold of a Application's Obey dir'.
>>I'm using Desktop C - so basically I need the path that resspr etc uses
>>to find its resources. At the mo. I'm launching the file with the usual
>>!Run, but with the ugly line...
>>
>>	Run <CADshell$Dir>.!RunImage "<CADshell$Dir>"
>>
>>	Then using argv [1] to pick it up - theres gotta be a better way ;-)

You can use <CADshell$Dir> within your program with no problems,
i.e. to open a file in your directory called 'resource':

  infile = fopen("<CADshell$Dir>.resource", "r");

-this assumes that in your !Run file you are using:
  Set CADshell$Dir <Obey$Dir>

If you want to use the same path as resspr, then use:

  {
    char pathname[256];

    res_findname("resource", pathname);

    fopen(pathname, "r");
  }

If you have done
  res_init("CADshell");
then the above code will fill 'pathname' with the string
  "<CADshell$Dir>.resource"
which can, as above, be used to find your resources.

(cf pages 252-253 of the desktop C manual)
-- 
_________________  "I'd like to answer this question in two ways:
  /____ _ _/_ __       First in my normal voice, and then
 // / //_//_ /_/       in a silly, high-pitched whine." (Monty Python)
Technical Details
Message-ID: <1992Dec19.051635.29483@cs.aukuni.ac.nz>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1
Newsgroups: comp.sys.acorn.tech
Subject: Help with C programming
Message-ID: <1992Dec19.051635.29483@cs.aukuni.ac.nz>
From: jwil1@cs.aukuni.ac.nz (TMOTA)
Date: Sat, 19 Dec 1992 05:16:35 GMT
Sender: jwil1@cs.aukuni.ac.nz (TMOTA)
Organization: Computer Science Dept. University of Auckland
Lines: 38