Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!uc!cs.umn.edu!thelake!steve From: steve@thelake.mn.org (Steve Yelvington) Newsgroups: comp.sys.atari.st.tech Subject: Malloc() and desk accessories Message-ID: Date: 23 Aug 90 20:01:56 GMT Lines: 30 I've seen comments to the effect that calling Malloc() from a desk accessory is a Bad Thing, and I wonder if that is always true. I want to write a desk accessory that will filter ASCII text into a format suitable for Pagestream. The Pagestream ASCII import function is brain-damaged -- it will not properly handle normal text with hard returns at the end of each line and paragraphs separated by a blank line (which is what you're reading right now). I want the DA to wake up from evnt_multi get a filename using fsel_exinput compute the file size open the file Malloc() enough memory for the whole file read all of it into the buffer strip line enders (except blank lines) write the modified file back to the disk close the file Mfree() the buffer return to evnt_multi There would not be a chance for an application to terminate while the allocated memory was being held. If the memory allocation follows the same rules as file handle ownership, there would not be a problem. True or false? -- Steve Yelvington up at the lake in Minnesota steve@thelake.mn.org plains!umn-cs!steve