home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14685 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.9 KB  |  53 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!haven.umd.edu!ni.umd.edu!zben-mac-ii.umd.edu!user
  3. From: zben@ni.umd.edu (Charles B. Cranston)
  4. Subject: Re: How to save a PICT file?
  5. Message-ID: <zben-280892151439@zben-mac-ii.umd.edu>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@ni.umd.edu (USENET News System)
  8. Nntp-Posting-Host: zben-mac-ii.umd.edu
  9. Organization: UM Home for the Terminally Analytical
  10. References: <5hnyk1d@rpi.edu> <1992Aug26.000749.3750@desire.wright.edu>
  11. Distribution: usa
  12. Date: Fri, 28 Aug 1992 19:16:42 GMT
  13. Lines: 38
  14.  
  15. In article <1992Aug26.000749.3750@desire.wright.edu>,
  16. jmatthews@desire.wright.edu wrote:
  17.  
  18. >   procedure DoSavePICT (picHdl: PicHandle);
  19. >     var
  20. >       reply: SFReply;
  21. >       getDlgTH: DialogTHndl;
  22. >       r: Rect;
  23. >       index, fRefNum: Integer;
  24. >       count: LongInt;
  25. >       buffer: array[0..127] of LongInt;
  26. >   begin
  27. >     getDlgTH := DialogTHndl(GetResource('DLOG', putDlgID));
  28. >     r := getDlgTH^^.boundsRect;
  29. >     CenterRect(ScreenRect, r);
  30. >     SFPutFile(r.topLeft, ResStr(savePictID), '', nil, reply);
  31. >     if reply.good then
  32. >       begin
  33. >         for index := 0 to 127 do {empty 512 byte PICT header}
  34. >           buffer[index] := 0;
  35. >         ErrorCheck(FSDelete(reply.fName, reply.vRefNum));
  36. >         ErrCheck(Create(reply.fName, reply.vRefNum, 'Bozo', 'PICT'));
  37. >         ErrCheck(FSOpen(reply.fName, reply.vRefNum, fRefNum));
  38. >         count := SizeOf(buffer);
  39. >         ErrCheck(FSWrite(fRefNum, count, @buffer));
  40. >         count := GetHandleSize(Handle(picHdl));
  41. >         ErrCheck(FSWrite(fRefNum, count, Ptr(picHdl^)));
  42.                                            ^^^^^^^^^^^^
  43. >         ErrCheck(FSCLose(fRefNum));
  44. >       end
  45. >   end;
  46.  
  47. Ahem, wouldn't it be a good idea to lock the handle while writing
  48. it out?  I wasn't aware _Write refrained from moving memory.  Please
  49. correct me if I'm wrong about this...
  50.  
  51. zben@ni.umd.edu     -KA3ZDF
  52.