FILEallocate_new_cluster Function

Microchip MDD File System Interface

MDDFS Interface Library Help
FILEallocate_new_cluster Function
C
BYTE FILEallocate_new_cluster(
    FILEOBJ fo, 
    BYTE mode
);
Description

This function will find an empty cluster on the device using the FATfindEmptyCluster function. It will then mark it as the last cluster in the file in the FAT chain, and link the current last cluster of the passed file to the new cluster. If the new cluster is a directory cluster, it will be erased (so there are no extraneous directory entries). If it's allocated to a non-directory file, it doesn't need to be erased; extraneous data in the cluster will be unviewable because of the file size parameter.

Preconditions

Should not be called by the user.

Parameters
Parameters 
Description 
fo 
Pointer to file structure 
mode 
  • 0 - Allocate a cluster to a file
  • 1 - Allocate a cluster to a directory

 

Return Values
Return Values 
Description 
CE_GOOD 
Cluster allocated 
CE_DISK_FULL 
No clusters available 
Side Effects

None

Remarks

None.

Microchip MDD File System Interface 1.2.0 - [Aug 18, 2008]
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.