AllocDiskSpace

3.1

  #include <stress.h>    

  int AllocDiskSpace(lLeft, uDrive)    
  long lLeft; /* number of bytes left available */
  UINT uDrive; /* disk partition, */  

The AllocDiskSpace function creates a file that is large enough to ensure that the specified amount of space or less is available on the specified disk partition. The file, called STRESS.EAT, is created in the root directory of the disk partition.

If STRESS.EAT already exists when AllocDiskSpace is called, the function deletes it and creates a new one.

Parameters

lLeft

Specifies the number of bytes to leave available on the disk.

uDrive

Specifies the disk partition on which to create the STRESS.EAT file. This parameter must be one of the following values:

Value Meaning

EDS_WIN Creates the file on the Windows partition.
EDS_CUR Creates the file on the current partition.
EDS_TEMP Creates the file on the partition that contains the TEMP directory.

Return Value

The return value is greater than zero if the function is successful; it is zero if the function could not create a file; or it is –1 if at least one of the parameters is invalid.

Comments

In two situations, the amount of free space left on the disk may be less than the number of bytes specified in the lLeft parameter: when the amount of free space on the disk is less than the number in lLeft when an application calls AllocDiskSpace, or when the value of lLeft is not an exact multiple of the disk cluster size.

The UnAllocDiskSpace function deletes the file created by AllocDiskSpace.

See Also

UnAllocDiskSpace