Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!burleigh
From: burleigh@cica.cica.indiana.edu (Frank Burleigh)
Newsgroups: comp.sys.ibm.pc
Subject: TC2: problem filling array of struct w/ findnext
Keywords: turbo c array structure findnext
Message-ID: <154@cica.cica.indiana.edu>
Date: 4 Oct 89 11:49:22 GMT
Distribution: na
Organization: IU, Bloomington
Lines: 36
once again i need to draw on net.experience.
this code:
#include
#include
struct ffblk file_list[20];
int fnd = 0;
fnd = findfirst( "*.*", file_list+0, 0 );
for( i = 1; fnd != -1; i++ )
fnd = findnext( file_list+i );
does not work right, and i have no doubt it is because i am not
properly referencing the addresses of the file_list array of
struct. the intent is simply to have findfirst/findnext put a
list of file into the file_list[i]. instead, the first file goes
in correctly, but then we drop out of the for loop with fnd = -1,
meaning either the filespec is bad or we've exhausted the dir.
this should not be happening.
if we un-array file_list and put a printf file_list.ff_name behind
the findnext, things work as expected.
this is a vastly stripped down version of the code.
i would very much appreciate any e-mail insights into my errors.
thank you muchly.
btw, this is tc2.0 and pc dos 4.01.
--
Frank Burleigh burleigh@cica.cica.indiana.edu
USENET: ...rutgers!iuvax!cica!burleigh BITNET: BURLEIGH@IUBACS.BITNET
Department of Sociology, Indiana University, Bloomington, Indiana 47405