home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!usenet.coe.montana.edu!rpi!batcomputer!cornell!csuley
- From: csuley@cs.cornell.edu (Christopher Suley)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Comparing strings 'n stuff...
- Message-ID: <1992Aug28.171916.16996@cs.cornell.edu>
- Date: 28 Aug 92 17:19:16 GMT
- Article-I.D.: cs.1992Aug28.171916.16996
- References: <1992Aug28.134804.9876@sun1x.actc.res.utc.com> <chuck-280892124136@choffman.gte.com>
- Organization: Cornell Univ. CS Dept, Ithaca NY 14853
- Lines: 22
-
- In article <chuck-280892124136@choffman.gte.com> chuck@gte.com (Chuck Hoffman) writes:
- >In article <1992Aug28.134804.9876@sun1x.actc.res.utc.com>,
- >rer@utrcv1.res.utc.com (Rick E Romkey) wrote:
- >>
- >>
- >> I am trying to compare a Str255 with a String which exists
- >> in my resource file. I have loaded it in, but I am at a loss
- >> as to what to do to compare these two strings to see if they
- >> are equivalent.
- >>
- >
- >If you are using THINK C, there are two routines for converting between
- >strings of Pascal format (with length byte at the beginning) and C format
- >(with null character at the end). They are "PtoCstr" and "CtoPstr". If
- >you get both strings into C format, then you can use the C library routine
- >"strncmp" to compare them, even if they are of dissimilar length.
- >
-
- If you stored the strings in your resource file in 'STR#' (string list)
- resources, you could use GetIndString to read them into a Str255 variable.
- Then, you could use IUMagIDString (or EqualString, I think) to compare them.
- All the calls mentioned are documented in Inside Macintosh volume 1.
-