www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/06/05:49:14

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: array of pointers to strings, BC++, DJGPP and weird printing behavior
Date: Tue, 05 Nov 1996 10:48:16 -0800
Organization: Alcyone Systems
Lines: 20
Message-ID: <327F8BF0.1FBC68D@alcyone.com>
References: <55nrvs$sdo AT solaris DOT cc DOT vt DOT edu>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Matthew Miller wrote:

> I have got the array of pointers to strings concept down,
> but now (I think) something weird is happening.  This code
> snippet (along w/ a main function) compiles without errors
> on both BC++ 3.1 and DJGPP. But, the executables don't act
> the same.  With DJGPP, running the exe. produces an endless loop
> of seg. faults. Also, the file that is opened is just a plain
> text file containing one word per line

Your problem is that you are not properly reallocating the array of char *
as you're intending.  Your realloc call always resizes the array to be one
char * long, when you need it to be constantly growing.

-- 
                             Erik Max Francis | max AT alcyone DOT com
                              Alcyone Systems | http://www.alcyone.com/max/
                         San Jose, California | 37 20 07 N 121 53 38 W
                                 &tSftDotIotE | R^4: the 4th R is respect
         "But since when can wounded eyes see | If we weren't who we were"

- Raw text -


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