al_findnext(3alleg4)

✨ al_findnext β€” the Allegro manual, but make it cute ✨

okay bestie, welcome to the Allegro manual page for al_findnext, from the Allegro game programming library πŸ’–


🌸 NAME 🌸

al_findnext β€” finds the next file in a search that was started by al_findfirst(). It's part of the Allegro game programming library, periodt. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

int al_findnext(struct al_ffblk *info);

πŸ’… DESCRIPTION πŸ’…

so basically, this one grabs the next file in a search that al_findfirst() already kicked off. you can't start the party here β€” al_findfirst() has to go first, no cap. πŸ¦‹

here's the vibe, in code:

if (al_findfirst("*.pcx", &info, 0) != 0)
   return;

do {
   /* Do something useful here with info.name. */
} while (al_findnext(&info) == 0);

al_findclose(&info);

like, look at that loop. the way it just keeps calling al_findnext(&info) until it stops returning 0? iconic behaviour honestly. πŸ”₯


⭐ RETURN VALUE ⭐

  • returns zero if a match is found πŸ₯³
  • returns non-zero if none is found, or if an error occurred
  • and in that error case specifically, it sets errno accordingly β€” so go check it, bestie πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘


mwah, that's the whole page 🫢 Allegro, version 4.4.3 β€” catch you on the next one, bestie, stay slaying those file searches πŸ’œβœ¨πŸŽ€