home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / acorn / tech / 1099 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.6 KB

  1. Path: sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1
  2. Newsgroups: comp.sys.acorn.tech
  3. Subject: Help with C programming
  4. Message-ID: <1992Dec19.051635.29483@cs.aukuni.ac.nz>
  5. From: jwil1@cs.aukuni.ac.nz (TMOTA)
  6. Date: Sat, 19 Dec 1992 05:16:35 GMT
  7. Sender: jwil1@cs.aukuni.ac.nz (TMOTA)
  8. Organization: Computer Science Dept. University of Auckland
  9. Lines: 38
  10.  
  11. >>    What the best method of getting hold of a Application's Obey dir'.
  12. >>I'm using Desktop C - so basically I need the path that resspr etc uses
  13. >>to find its resources. At the mo. I'm launching the file with the usual
  14. >>!Run, but with the ugly line...
  15. >>
  16. >>    Run <CADshell$Dir>.!RunImage "<CADshell$Dir>"
  17. >>
  18. >>    Then using argv [1] to pick it up - theres gotta be a better way ;-)
  19.  
  20. You can use <CADshell$Dir> within your program with no problems,
  21. i.e. to open a file in your directory called 'resource':
  22.  
  23.   infile = fopen("<CADshell$Dir>.resource", "r");
  24.  
  25. -this assumes that in your !Run file you are using:
  26.   Set CADshell$Dir <Obey$Dir>
  27.  
  28. If you want to use the same path as resspr, then use:
  29.  
  30.   {
  31.     char pathname[256];
  32.  
  33.     res_findname("resource", pathname);
  34.  
  35.     fopen(pathname, "r");
  36.   }
  37.  
  38. If you have done
  39.   res_init("CADshell");
  40. then the above code will fill 'pathname' with the string
  41.   "<CADshell$Dir>.resource"
  42. which can, as above, be used to find your resources.
  43.  
  44. (cf pages 252-253 of the desktop C manual)
  45. -- 
  46. _________________  "I'd like to answer this question in two ways:
  47.   /____ _ _/_ __       First in my normal voice, and then
  48.  // / //_//_ /_/       in a silly, high-pitched whine." (Monty Python)
  49.