home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22000 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  1.7 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!darkstar.UCSC.EDU!cats.ucsc.edu!speth
  2. From: speth@cats.ucsc.edu (James Gustave)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Recommended way to deal with large memory buffers?
  5. Date: 23 Jan 1993 03:35:43 GMT
  6. Organization: University of California; Santa Cruz
  7. Lines: 24
  8. Message-ID: <1jqeefINNcio@darkstar.UCSC.EDU>
  9. References: <9301221923.aa23160@Paris.ics.uci.edu>
  10. NNTP-Posting-Host: am.ucsc.edu
  11.  
  12.  
  13.   I'm working on an encryption application, and I need to go through a file,
  14. encrypt it, and write it to a new file.  The encryption routine takes a Ptr
  15. to a buffer, and a count of the number of bytes to process.  For small files,
  16. it makes sense to read the whole file into the buffer and do the encryption.
  17. However, this means that the maximum size of the file to be encrypted is
  18. determined by the amount of memory the program can allocate.  On the other
  19. hand, if I did the encryption incrementally, writing the parts to a temp file,
  20. then there might be a lot of unnecessary disk access which would slow down
  21. the process.
  22.  
  23.   What is the recommended way of working with large files?  Should I read it
  24. all in, or use temp files?  Or should I read as much in as possible and only
  25. create temp files when necessary (maybe I just answered my own question :)
  26.  
  27.   Another question, sometimes I need to add a prefix packet to the beginning
  28. of the buffer.  Is there an easy way to prepend stuff to a buffer, without
  29. allocating a new buffer, writing the info, then doing a block move?
  30.  
  31. Thanks.
  32.  
  33. -- 
  34. ________________________________________________________________________________
  35. james speth           email for pgp 2.0 public-key           speth@cats.ucsc.edu
  36.