Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!hplabs!sri-unix!LAVITSKY@RU-BLUE.ARPA From: LAVITSKY@RU-BLUE.ARPA Newsgroups: net.lang.c Subject: Help with malloc() ... Message-ID: <12358@sri-arpa.UUCP> Date: Thu, 9-Aug-84 15:41:59 EDT Article-I.D.: sri-arpa.12358 Posted: Thu Aug 9 15:41:59 1984 Date-Received: Wed, 15-Aug-84 06:40:05 EDT Lines: 28 From: EricHi, I'm quite a novice to C, and would like to know if anyone could help me with the following: I need to allocate memory space for some buffers in the following manner: In the middle of my program I read in some parameters from a file which will determine the size of my buffer space. The parameters are two integers - and the buffer itself will contain integers. So, if I read in a value of 8192 from my file header - I need to then allocate my buffers to be exactly 8192 bytes of type integer. I will also be reading data into the buffers from this file. How do I use malloc() to allocate my buffer space ? Everything I read so far is very vague as to how this is used. I would like to read data into the array and allocate each byte of the array dynamically as it is needed. Something like: get buffer size; loop: allocate buffer byte; read data into buffer; untill buffer size; Thanx, Eric -------