delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/08/11:15:35

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Segmentation fault in UNIX
Date: Fri, 08 May 1998 08:01:04 -0700
Organization: Alcyone Systems
Lines: 20
Message-ID: <35531E30.3E308AEB@alcyone.com>
References: <35519D05 DOT 18BA AT cc DOT hut DOT fi> <3553edeb DOT 3391725 AT news DOT Austria DOT EU DOT net>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gerhard Gruber wrote:

> No memory allocated for lin and pin.
> 
> before you call gets() you have to have some line like
> if((lin = malloc(<len>)) == NULL)
> {
>         fprintf(stderr, "not enough memory\n");
>     exit(1);
> }

Or how about just declare them as a static array?

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm:+37.20.07/-121.53.38
                                     \
   "Even if opponents are numerous, / they can be made not to fight."
                                   / Sun Tzu

- Raw text -


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