home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!haven.umd.edu!ni.umd.edu!zben-mac-ii.umd.edu!user
- From: zben@ni.umd.edu (Charles B. Cranston)
- Subject: Re: How to save a PICT file?
- Message-ID: <zben-280892151439@zben-mac-ii.umd.edu>
- Followup-To: comp.sys.mac.programmer
- Sender: usenet@ni.umd.edu (USENET News System)
- Nntp-Posting-Host: zben-mac-ii.umd.edu
- Organization: UM Home for the Terminally Analytical
- References: <5hnyk1d@rpi.edu> <1992Aug26.000749.3750@desire.wright.edu>
- Distribution: usa
- Date: Fri, 28 Aug 1992 19:16:42 GMT
- Lines: 38
-
- In article <1992Aug26.000749.3750@desire.wright.edu>,
- jmatthews@desire.wright.edu wrote:
-
- > procedure DoSavePICT (picHdl: PicHandle);
- > var
- > reply: SFReply;
- > getDlgTH: DialogTHndl;
- > r: Rect;
- > index, fRefNum: Integer;
- > count: LongInt;
- > buffer: array[0..127] of LongInt;
- >
- > begin
- > getDlgTH := DialogTHndl(GetResource('DLOG', putDlgID));
- > r := getDlgTH^^.boundsRect;
- > CenterRect(ScreenRect, r);
- > SFPutFile(r.topLeft, ResStr(savePictID), '', nil, reply);
- > if reply.good then
- > begin
- > for index := 0 to 127 do {empty 512 byte PICT header}
- > buffer[index] := 0;
- > ErrorCheck(FSDelete(reply.fName, reply.vRefNum));
- > ErrCheck(Create(reply.fName, reply.vRefNum, 'Bozo', 'PICT'));
- > ErrCheck(FSOpen(reply.fName, reply.vRefNum, fRefNum));
- > count := SizeOf(buffer);
- > ErrCheck(FSWrite(fRefNum, count, @buffer));
- > count := GetHandleSize(Handle(picHdl));
- > ErrCheck(FSWrite(fRefNum, count, Ptr(picHdl^)));
- ^^^^^^^^^^^^
- > ErrCheck(FSCLose(fRefNum));
- > end
- > end;
-
- Ahem, wouldn't it be a good idea to lock the handle while writing
- it out? I wasn't aware _Write refrained from moving memory. Please
- correct me if I'm wrong about this...
-
- zben@ni.umd.edu -KA3ZDF
-