home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!reed!bowman
- From: bowman@reed.edu (BoBolicious)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: assigning a StringPtr to an array of Str255s?
- Message-ID: <1993Jan9.005725.3063@reed.edu>
- Date: 9 Jan 93 00:57:25 GMT
- Article-I.D.: reed.1993Jan9.005725.3063
- References: <16B50FE12.UC525655@mizzou1.missouri.edu>
- Organization: Reed College, Portland, OR
- Lines: 23
-
- In article <16B50FE12.UC525655@mizzou1.missouri.edu> UC525655@mizzou1.missouri.edu (Mark Eaton) writes:
- >struct someStuff
- > {
- > ...
- > str255 contents[99];
- > }
- >
-
- Instead of Str255, methinks you want "unsigned char *".
-
- Your scheme allocates 256*99 ~= 25K; that is, it actually allocates 99
- 256 byte array. You code, however, assumes you want these to be pointers,
- not the actual storage space. If you *do* want the storage space, then
- when you use ioNamePtr, you'll need to explicitly copy the strings from
- wherever ioNamePtr is pointing into the appropriate string, something like
-
- pStrcpy(&(someStuffStruct->contents[i]),ioNamePtr);
-
- chars,
- bobo In seeking the unattainable,
- bowman@reed.edu simplicity only gets in the way.
- "On Monday, numbers floated everywhere, and the world was full of
- approximations." -- Spencer Heinz, _The Oregonian_, 1/5/93
-