Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!information-systems.east-anglia.ac.uk!jrk From: jrk@information-systems.east-anglia.ac.uk (Richard Kennaway CMP RA) Newsgroups: comp.sys.mac.programmer Subject: GetScrap problem Message-ID: <3640.9101221218@s4.sys.uea.ac.uk> Date: 22 Jan 91 12:18:43 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 23 In someone's code, I saw this: > h = NewHandle(0); > length = GetScrap(h,theType,&offset); I've had problems with reading the scrap that way. Reading a large 'TEXT' scrap, I sometimes find that I end up with junk in the handle, as if it got moved after the scrap was read into it, but without its contents being copied. Instead I ensure the handle is already big enough: length = GetScrap( nil, theType, &offset ); h = NewHandle( length ); GetScrap( h, theType, &offset ); (I've left out the checking for length<0 or h==nil that a real program would do.) I find this works; but nothing I've seen in IM or the TNs suggests that the previous code should fail. What is going on? -- Richard Kennaway SYS, University of East Anglia, Norwich, U.K. Internet: jrk@sys.uea.ac.uk uucp: ...mcsun!ukc!uea-sys!jrk