Path: utzoo!utgpu!news-server.csri.toronto.edu!qucdn!spraggej Organization: Queen's University at Kingston Date: Wednesday, 17 Apr 1991 17:44:04 EDT From: John G. Spragge Message-ID: <91107.174405SPRAGGEJ@QUCDN.QueensU.CA> Newsgroups: comp.lang.pascal Subject: Re: need dynamic array on heap References: <1991Apr12.234843.9031@ux1.cso.uiuc.edu> <4816@gumby.Altos.COM> <7294@vice.ICO.TEK.COM> In article <7294@vice.ICO.TEK.COM>, bobb@vice.ICO.TEK.COM (Bob Beauchaine) says: > > type byte_buf = array[1..64000] of byte; > byte_buf_ptr = ^byte_buf; > > var buffer : pointer; > . > . > getmem(buffer,somesize); { Allocate only as many bytes as you need } > byte_buf_ptr(buffer)^[2] := somevalue; Actually, since GETMEM takes ANY pointer type, you don't need the typecast. You don't have to allocate enough memory for the structure you're loading; you just have to be sure your code will manage dynamic structures correctly. disclaimer: Queen's University supplies me with computer services, not my opinions. John G. Spragge