Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!apple!apple.com!dowdy From: dowdy@apple.com (Tom Dowdy) Newsgroups: comp.sys.mac.programmer Subject: Re: Trouble with using Munger Message-ID: <9135@goofy.Apple.COM> Date: 13 Jul 90 21:40:03 GMT Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 28 References:<477@psych.psy.uq.oz.au> <42915@apple.Apple.COM> <11122@claris.com> <42936@apple.Apple.COM> Okay fine. Nobody else has gotten the right answer, so I'll try :-) In article <42936@apple.Apple.COM> keith@Apple.COM (Keith Rollin) writes: > In article <11122@claris.com> drc@claris.com (Dennis Cohen) writes: > >keith@Apple.COM (Keith Rollin) writes: > >>In article <477@psych.psy.uq.oz.au> strasser@psych.psy.uq.oz.au (Michael Strasser) writes: > >>> [ asks why Munger fails on the following call ] > >>> aChar : Char; > >>> where := Munger(text, offset, @aChar, 1, NIL, 0); > >>[ Keith suggests that there is a length byte screwing him up ] > >[ Dennis points out that Chars don't have length bytes ] > [ Keith is embarassed ] This is actually caused by the fact that Pascal will store a char as a short. @Char is giving you a pointer to the high order byte, which is NOT where the data is, it's in the low order byte. So, Ptr(ORD(@Char)+1) is the right way to pass a pointer to a char in Pascal. Keith had the right idea, but the wrong reason. The real reason why this doesn't work is that Pascal sucks. :-) Tom Dowdy Internet: dowdy@apple.COM Apple Computer MS:81EQ UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy 20525 Mariani Ave AppleLink: DOWDY1 Cupertino, CA 95014 "The 'Ooh-Ah' Bird is so called because it lays square eggs."