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