Borland C++ reference

findnext

raw OCR

Continues findfirst search.

Defined in header <dir.h>

Syntax

#include <dir.h>
int findnext(struct ffblk Jfblk);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

findnext is used to fetch subsequent files that match the pathname given in findfirst. ffblk is the same block filled in by the findfirst call. This block contains necessary information for continuing the search. One file name for each call to findnext will be returned until no more files are found in the directory matching the pathname.

Return value

findnext returns 0 on successfully finding a file matching the search pathname. When no more files can be found, or if there is some error in the file name, -1 is returned, and the global variable errno is set to

ENOENT Path or file name not found

and doserno is set to one of the following:

ENOENT Path or file... ENMFILE No more files

See also

Example

#include <stdio.h>
#include <dir.h>

int main(void)
{
   struct ffblk ffblk;
   int done;
   printf("Directory listing of  *.*\n");
   done = findfirst("*.*",&ffblk,0);
   while (!done) {
      printf("  %s\n", ffblk. ff_name);
      done = findnext (&ffblk);
   }
   return 0;
Program    output

Directory listing of
   FINDFRST.C
   FINDFRST.OBJ
   FINDFRST.EXE

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.