www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/30/21:46:53

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: having problem with malloc
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <h9m9osoc8tunmdqa1tielt2io2dgd80m2q@4ax.com>
References: <39847485 DOT 5822 AT virgin DOT net> <3984b5d5 DOT 48960018 AT news DOT wins DOT uva DOT nl>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 26
X-Trace: /K+neUDoXr132Ct+aKpjJAKWhgojdivCEjkDdxOYIInJ+I8pYofgkkei2N/tk+lwVDY2BvZOBHNM!cp6zQN4wPZrv9QtTx56ZCEXd49ECYhPfxjkxkai+1skNfu6+Y3j6P7YM0jPtBDJZFTwGaqJ/YaEU!ldEw
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Mon, 31 Jul 2000 01:41:56 GMT
Distribution: world
Date: Mon, 31 Jul 2000 01:41:56 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Mon, 31 Jul 2000 00:06:28 GMT, eglebbk AT dds DOT nl (Evert Glebbeek)
wrote:

>>int getfilelen(unsigned char *file) {
>There has to be a library function to do this (or maybe it's stored in
>the FILE * structure); though it's not standard ANSI. Might be Posix,
>but someone else would probably know better.

fopen() the file
fseek() to end
ftell() gives length
fseek() back to beginning

>If you want to allocate a
>block of memory set to all 0's, as it looks like you want, the library
>function calloc does that, so you could use that rather than malloc.

Is calloc() defined in ANSI, POSIX, Borland GNU, or what?

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019