Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!giza.cis.ohio-state.edu!sas From: sas@giza.cis.ohio-state.edu (Scott Sutherland) Newsgroups: comp.sys.mac.programmer Subject: Problems spooling a picture to a file Message-ID: <98601@tut.cis.ohio-state.edu> Date: 20 Mar 91 19:48:33 GMT Sender: news@tut.cis.ohio-state.edu Distribution: all Organization: Ohio State University, Department of Dance Lines: 50 Regarding spooling a picture to a file, Inside Mac V, p. 89 gives an example that includes the following var and a procedure that replaces the standard PutPicProc and does the actual spooling to disk: -------------------------------------------------------- var PICTcount: Longint; {the current size of the picture} ... procedure PutPICTData; var longCount: Longint; err: Integer; begin longCount := byteCount; PICTcount := PICTcount + byteCount; err := FSWrite(globalRef, longCount, dataPtr); if newPICThand <> nil then newPictHand^^.picSize := PICTcount; end; -------------------------------------------------------- Playing around with it, I found that it does not work when the size of the PICT is greater than 32K. This is so because in the following line: newPictHand^^.picSize := PICTcount; PICTcount will end up being greater than 32000, and so newPictHand^^.picSize will overflow because it is an integer. To fix it, I changed the line to : newPictHand^^.picSize := LoWord(PICTcount); and it seems to work fine since according to IM V-87, picSize is the low order 16 bits of the picture size in version 2 pictures. The REAL question is whether I've overlooked anything? Anyone had to deal with this? Thanks in advance, Scott --- Scott A. Sutherland Internet:scott@dance.ohio-state.edu; AT&T Mail:!scottas Staff Macintosh Developer Phone: 614/292-7977; Fax 614/292-0939 The Ohio State University, Department of Dance