www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/24/13:45:39

Message-ID: <001601c0e479$71268720$0700a8c0@chello.at>
From: "Maverick" <vhd AT chello DOT at>
To: <djgpp AT delorie DOT com>
References: <GG5P6.190356$2q DOT 6453960 AT news DOT chello DOT at> <2593-Thu24May2001195721+0300-eliz AT is DOT elta DOT co DOT il>
Subject: Re: code snippet trouble
Date: Thu, 24 May 2001 19:46:20 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Reply-To: djgpp AT delorie DOT com

----- 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 -


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