www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/24/23:12:41

From: Pyros <yagoda AT netvision DOT net DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: HELP: program won't start if i call this proc
Date: Tue, 24 Aug 1999 23:02:44 +0300
Organization: NetVision Israel
Lines: 58
Message-ID: <37C2FA62.EB9237E6@netvision.net.il>
NNTP-Posting-Host: ras1-p76.hdr.netvision.net.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 935524814 21610 62.0.176.78 (24 Aug 1999 20:00:14 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 24 Aug 1999 20:00:14 GMT
X-Mailer: Mozilla 4.51 [en] (Win95; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

heya somebody

i wrote this procedure, but when i put a call for it in main(), compile
and run,
the program doesn't even finish the self-setting-up phase.
i use rhide, with -O3 tag.
here's the proc: (it's supposed to read a chain of int coords from file
fn, into
the chain based at blp).

typedef struct landp //points read from file
{
 int relx,y;
 landp * r; //right
};

void readland(char * fn,landp ** blp) //blp=baselandp
{
 landp * lp;
 *blp=NULL;
 FILE * f=fopen(fn,"rb");
 if (f)
   {
    int read;
    fread(&read,2,1,f);
    while (read!=0xffff)
      {
       if (*blp) lp=(lp->r=(landp *)malloc(sizeof(landp)));
       else *blp=lp=(landp *)malloc(sizeof(landp));
       lp->relx=read;
       fread(&read,2,1,f); //not sure how to do it with direct pointer
access
       lp->y=read;
       fread(&read,2,1,f); //not sure how to do it with direct pointer
access
      }
    lp->r=NULL;
    fclose(f);
   }
}

i can't see any reason for this to happen... :-(
can you please tell me why?
                                                  Avishay
--
Pyros:
 _O_  M
|\P/|/
|) (
o|-|
 | |
The Man Who Holds Fire In His Hand
----------------------------------
Avishay Yagoda
http://www.geocities.com/SiliconValley/Lakes/6993
E-mail: yagoda AT netvision DOT net DOT il


- Raw text -


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