Information Technology Reference
In-Depth Information
// Store the entry's attributes.
a = dir->DIR_Attr;
fo -> attributes = a;
} // End: the entry isn't deleted
} // End: an entry exists
return(status);
}
Finding a File
The FILEfind function searches for a specific file in a directory or for an
empty entry. The function accepts two FILEOBJ pointers to FILE struc-
tures. One structure (foCompareTo) contains a file name to search for and
the other (fodest) will hold information about a file or empty entry if found.
The third parameter (cmd) indicates whether to search for an entry that
matches the file name in foCompareTo (1) or an empty entry (2). The func-
tion returns a status code.
The function calls the Cache_File_Entry function from Chapter 9 and the
Fill_File_Object function above. In the passed file structure, the dirclus
member must contain the number of the first cluster in the directory to
search.
#define ATTR_MASK 0x3f
#define ATTR_HIDDEN 0x02
#define ATTR_VOLUME 0x08
#define FOUND 0 // directory entry match
CETYPE FILEfind(FILEOBJ foDest, FILEOBJ foCompareTo, byte cmd)
{
word
attrib;
byte
character;
word
fHandle = 0;
byte
index;
byte
state;
CETYPE
statusB = CE_FILE_NOT_FOUND;
byte
test;
Search WWH ::




Custom Search