Function findfirst

Top 

Declaration:

int findfirst(char path[], char ffblk[], int attrib);

Description

Starts search for files with the attributes specified in parameter attrib by the mask specified in path. The search can be continued with the findnext function.

The ffblk parameter specifies an internal data storage buffer for the function. Its size should be 48 bytes.

After findfirst access, the ffblk buffer contains information about the found file. The _ff_attrib, _ff_time, _ff_date, _ff_size and _ff_name functions receive ffblk as the parameter and return information on the file.

Returned value

If the specified file is found, it will return 0, and -1 otherwise.

Example

      char ffblk[48];

      int done = findfirst("c:\\data.*", ffblk, 0);

      long total_size = 0;

      while (@!done)

      {

        total_size += _ff_size(ffblk);

        done = findnext(ffblk);

      }

      printf("Total size of the files @%lu", total_size);