C – Struct ffblk 

C – Struct ffblk  2017-07-27T01:47:53+00:00

Struct ffblk :

  • Using this structure we can get information of a file or a directory.
  • It is included in  the header file <dir.h>

Syntax :

struct ffblk

{

char ff_reserved[21];      //reserved by DOS

char ff_attrib;                  //attribute found

char ff_ftime;                  //file time

char ff_fdate;                  //file date

char ff_fsize;                  //file size

char ff_name;                 //found file name

};

findfirst() :

It searches a disk directory for file.

Syntax :

int findfirst(const char *pathname,struct ffblk *f,int attrib);

List of attributes :

These attributes are included in the header file <dos.h>

        CONSTANT                                    DESCRIPTION

         FA_RDONLY                                   Read only attribute

         FA_HIDDEN                                   Hidden files

         FA_SYSTEM                                    System files

         FA_LABEL                                       Volume label

         FA_DIREC                                       Directory

         FA_ARCH                                        Archive file (ie. all files except

System files and volume lebel)

Returns value 0 on success(match found), else returns non zero value.

findnext() :

It continues the search.

Syntax :

int findnext(struct ffblk *f);

Returns value 0 on success(match found), else returns non zero value.

C – EXAMPLE PROGRAM FOR STRUCTFFBLK :

Output :

1) Enter path :

*.*

It will display all file in the current working directory.

 

2) Enter path :

*.c

It will display all .C programs in the current working directory.

Prev Next