home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- >> 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)
-