home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20279 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.6 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!comlab.ox.ac.uk!oxuniv!vollrath
  2. From: vollrath@vax.oxford.ac.uk
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Resource help?
  5. Message-ID: <1992Dec23.171644.10984@vax.oxford.ac.uk>
  6. Date: 23 Dec 92 17:16:44 GMT
  7. References: <1h7hg5INNhmr@gap.caltech.edu>
  8. Organization: Oxford University VAX 6620
  9. Lines: 35
  10.  
  11. In article <1h7hg5INNhmr@gap.caltech.edu>, chriswd@cco.caltech.edu (Chris Michael Ward) writes:
  12. > I was wondering if someone could help me out.  As a newtimer to Macintosh
  13. > programming, I am in the process of learning how to use resources.  I'm
  14. > trying to get the data from a simple 'STR#' resource, but it doesn't
  15. > seem to be working correctly.  
  16. > Should I do something like this:?
  17. > aHandle = GetResource ('STR#', RES_ID);
  18. > the_string = (char *) aHandle;
  19. > strncpy (temp_string, the_string, 2);
  20. > num_words = (int) temp_string;
  21. > ... then proceed to get the character data as the_string[x]?
  22. > I'm sure I'm probably approaching this problem incorrectly.  Any advice
  23. > would be greatly appreciated.  (I can't seem to find any more info in
  24. > Inside Macintosh)
  25. > Thank you greatly!
  26.  
  27. > - Chris
  28.  
  29. Actually, string resources are easier to handle than this. The routines
  30. you want are GetIndString (for STR# resources, IM I-468), and GetString
  31. (for STR resources, ibid). Here are the pascal definitions:
  32. function GetString(stringID:Integer):StringHandle;
  33. procedure GetIndString(var theString:Str255; strListID:Integer;
  34.     index:Integer);
  35.  
  36. My C is too rusty to fill in the pascal converion stuff.
  37.  
  38. Alun ap Rhisiart
  39. Animal Behaviour Research Group
  40. Oxford University
  41.