good idea!! i didn't think in this!!
On 23/02/07, Martin Jenkins <[EMAIL PROTECTED]> wrote:
Cesar Rodas wrote:
> while ( (n=fread(buff,Buffsize,1,file)) > 0)
> {
> if (i>0)
> *value = realloc(*value, (i+1) * Buffsize);
> memcpy(*value + (i * Buffsize), buff, Buffsize);
> *len += n;
> i++;
> }
An afterthought, why don't you just stat the file and malloc the right
sized buffer from the outset? Much easier.
Martin
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------
--
Cesar Rodas
http://www.sf.net/projects/pagerank (The PageRank made easy...)
http://www.sf.net/projects/fastfs ( The Fast File System)
Mobile Phone: 595 961 974165
Phone: 595 21 645590
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------