TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Dominique Curtis
date: 1998-10-23 12:45:34
subject: malloc and the resulting

Hello Jason,

DC> char *malloc();

 JB> why not #include the header for it?  Do this instead:
 JB> #include 

People keep asking me this.. the example I got out of my book on C, 
includes that declaration.. I am also including  for other things
that was just code fragments I posted.

If I comment out that decalration, my program runs out of memory within minutes.


DC>         if ((fp=fopen("dictphse.dat","r")) == NULL)

 JB> do you ever close this file ? ( flcose(fp) )

I'll check, but I'm pretty sure I did..

DC> I don't know if it makes a diffence, but I am using the FILE *fp;
DC> declaration in all file-operation files.
DC> If needed, I can post the file functions that mess up. Thanks...

 JB> If you want them all to refer to the same physical 
 JB> variable there had better
 JB> be all but one of those declarations being "extern FILE 
 JB> *fp", but from your
 JB> example above they are local variables to separate 
 JB> functions that each fopen a

Exactly.. they were all local to the functions, with one global FILE *fp;
used for main() I think....

caio!

--- Maximus 2.01wb
* Origin: Basic'ly Computers: Mooo-ing Right Along. (1:153/9)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 810 639/252
SEEN-BY: 670/218
@PATH: 153/104 2 716 7715 140/1 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.