delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/24/03:41:16

From: G DOT DegliEsposti AT ads DOT it
To: "Helix" <maciek AT compmore DOT net>
cc: djgpp AT delorie DOT com
Message-ID: <C12565D1.002DCFA2.00@vega.ads.it>
Date: Tue, 24 Mar 1998 09:35:45 +0100
Subject: Re: The for_each_file function, HELP!!!
Mime-Version: 1.0




>I've been writting my code and I've reached another stump. What I need is
a
>function which displays all the files in the current directory with the
>extention "map", something like "World.map". It would also be nice if the
>user could select the file and load it up. I think I've found a function
in
>the allegro libraries, named (for_each_file) but I don't understand the
>last two arguments of the function, it's attrib and a param. My Callback
I haven't got the Allegro docs here so my reply is based on memory only:

attrib should be a set of flag FA_* for matching files not only with
filenames
but also with attributes. (Have a look at libc docs 'findfirst' for more
info)

param is an optional argument which gets passed to your callback function
for
every call.

>for_each_file("*.map", NULL, callback(), NULL);
Here you have to specify a pointer to "callback" function! remove the "()"
because this way you are making a call to it!

>callback()
>{
> int d=0;
> d=d+15;
>
> textout(screen, font, "Does exits", 272+d, 147, 104);
>}

ciao
  Giacomo


- Raw text -


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