From: Vic Newsgroups: comp.os.msdos.djgpp Subject: Re: Help With Reading File Using DJGPP/Alegro Date: Sat, 28 Jun 1997 15:15:47 -0400 Organization: Communications Accesibles Montreal Lines: 33 Message-ID: <33B562E3.3703@cam.org> References: <01bc82b0$d9fca740$46a333cf AT gisco DOT net DOT gisco DOT net> Reply-To: tudor AT cam DOT org NNTP-Posting-Host: dynppp-26.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ben Cohee wrote: > > Hello I am new to DJGPP and am using Allegro for all my graphic routines > for now because of the change in regular dos mode to protected mode. I > need to read in a file which is my 3d coordinates for an object which has a > very simple format. My other reader wouldnt work in DJGPP. I guess the > file could also be used as a binary file with the Allegro packfiles since > its just an ascii file. This is the format : > 4 1 > 10 10 10 /* the 4 */ > 10 -10 10 /* is the number */ > -10 10 10 /* of lines here which always */ > -10 -10 10 /* consist of 3 numbers */ > 4 0 1 2 3 /* the 1 is the number of these lines */ > /* which is the number of points in the polygon [4] */ > /* and the number of points[4] after it [0 1 2 3] */ 1) I don't get the part with "the 1 is the number of these lines which is the number of points in the polygon [4] and the number of points[4] after it [0 1 2 3] " at all! whadda ya mean? 2) about reading files: you declare a file pointer: FILE *fp; you open the file for reading: fp=fopen("model.plg","r"); you read from it with fscanf (use fscanf exactely like scanf but the first argument will be the file pointer): fscanf(fp,"%d",&Integer); > Thanx in advance. -- --> http://www.cam.org/~tudor <-- prick your finger it is done the moon has now eclipsed the sun the angel has spread it's wings the time has come for bitter things