tf_space(), sf_space()

Purpose

Finds free space on disk

Old names

#define _vdspace tf_space

#define _adspace sf_space

Syntax (CCOWN)

file_pointer tf_space(const char *file_name)
file_pointer sf_space(const char *file_name)

Syntax (DP4DBAPI)

dp4_file_size dp4_sf_space(CONN * conn,dp4_name_string filename);
dp5_file_size dp4_sf64_space(CONN * conn,dp4_name_string filename);

Parameters

const char* file_name

Name of file on disk

Description

The tf_space() and sf_space() functions return the free disk space in bytes, of the disk on which the file resides. The file need not exist.

The 32 bit version of thi API is unreliable, as most disks have more free space than can be returned in a 32 bit value. If 2 Gigabytes or more are available DP4 returns 2 Gigabytes-1 bytes. Use the 64 bit version of the API for a reliable value. Even so, this function is unreliable in some environments. For example, a drive may be compressed so that the amount of free space is unknown.

Return values

Returns the free disk space, or 0L if the drive is invalid. The value returned is likely to be innaccurate unless you use the 64 bit version of this function.