Mail Archives: djgpp/2001/05/24/13:45:39
----- Original Message -----
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
To: Maverick <vhd AT chello DOT at>
Cc: <djgpp AT delorie DOT com>
Sent: Thursday, May 24, 2001 6:57 PM
Subject: Re: code snippet trouble
> > From: "Maverick" <vhd AT chello DOT at>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: Thu, 24 May 2001 10:49:10 GMT
> >
> > void create_new_palette(void)
> > {
> > int z;
> > char fullpath[22]="tiles.bmp\\";
> > char filename[6];
> > struct find_t chkfile;
> > FILE *liste, *graphic;
> > set_standard_colors();
<-does
> > nothing right now
> > liste=fopen("tiles.bmp\\chktiles.lst","wb");
> > if(_dos_findfirst("tiles.bmp\\*dt.bmp", 0, &chkfile)) <- seems to
be
> > wrong
> > do
> > {
> > fputc(chkfile.name[0], liste);
> > fputc(chkfile.name[1], liste);
>
> The logic is backwards here: _dos_findfirst returns zero when it
> succeeds, non-zero otherwise.
>
> Also, why do you use _dos_findfirst instead of findfirst? The latter
> supports long file names on Windows, while the former does not.
>
> > while (!_dos_findnext(&chkfile)); <- I guess that's my big
error
> > --------- Code below isn't reached and I don't know
why -------------------
>
> Why do you call _dos_findnext at all, if you have no use for the
> results it returns?
I got it working without crashing, but I still don't know if it is completly
right that way. Lem'me explain, to straigthen the thing out I want to do.
This thing should do the following :
Check for a match with _dos_firstfind() and if this match is found and loop
with _dos_findnext() until no more matches are found. I wrote it this way,
since I bet _dos_findnext() will be excuted after the loop, and if it finds
a match will recall the loop, until no more file matches are found. It
should work this way.
I use _dos-syntaxes simply because I want compatibility in DOS as well. I
might be working on another machine some of the stuff, and then I'd be
pretty messed up since that machine can't even handle WIN95, unless I am
badly informed and findfirst() doesn't care if it is WIN or not.
Btw : Do you know how to clear the keyboard buffer after calling bioskey(1)?
Thx, Maverick
- Raw text -