Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!usc!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Trouble with using Munger Message-ID: <42915@apple.Apple.COM> Date: 12 Jul 90 18:31:25 GMT References: <477@psych.psy.uq.oz.au> Organization: Apple Computer Inc, Cupertino, CA Lines: 37 In article <477@psych.psy.uq.oz.au> strasser@psych.psy.uq.oz.au (Michael Strasser) writes: >I am having a problem using Munger in a macApp program I'm writing. I >am trying to use it as part of a simple text-parsing routine. Here is >an example of what I have now: > >Given: > > VAR > aChar : Char; > text : Handle; > offset : LONGINT; > where : LONGINT; > >I have text set correctly (I've checked this), and offset set to 0. >I then try to find the first tab character in a string which I know >contains at least one tab using: > > aChar := chTab; > where := Munger(text, offset, @aChar, 1, NIL, 0); > >but Munger returns -1, signifying that the string was not found. > >Am I doing anything wrong? According to my reading of IM, it should be >OK. You're passing a pointer to the length byte of "aChar", rather than the first character of aChar. Try: where := Munger(text, offset @aChar[1], Length(aChar), NIL, 0); -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions