ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/09/11:30:02

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Please help where am i wrong
Date: 9 Apr 2002 15:22:27 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 20
Message-ID: <a8v0vj$jc$1@nets3.rz.RWTH-Aachen.DE>
References: <5a91d0ef DOT 0204090628 DOT 64a394f0 AT posting DOT google DOT com>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1018365747 620 137.226.32.75 (9 Apr 2002 15:22:27 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 9 Apr 2002 15:22:27 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Pradeepto K Bhattacharya <pradeeptob AT yahoo DOT com> wrote:

[...]
>   fscanf(data,"%d %d %f",&pts[i][j].x,&pts[i][j].y,&pts[i][j].z);

This is severely wrong.  Had you followed usual advice about how to
use GCC (i.e. use -g -Wall -O2 flags), you'ld have been told about it
by a compiler warning, too: the format specifiers don't match the type
of output variables in that fscanf() call.  Make that

	struct points *this = pts[i] + j;
	fscanf(data, "%f%f%f", &this->x, &this->y, &this->z);

and you'll have both clearer source code and be closer to a working
program.


-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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