www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/24/12:59:18

Date: Thu, 24 May 2001 19:57:22 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Maverick" <vhd AT chello DOT at>
Message-Id: <2593-Thu24May2001195721+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <GG5P6.190356$2q.6453960@news.chello.at> (vhd@chello.at)
Subject: Re: code snippet trouble
References: <GG5P6.190356$2q DOT 6453960 AT news DOT chello DOT at>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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

- Raw text -


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