Condividi tramite


FSIZE( ) Function

Returns the size in bytes of a specified field or file.

FSIZE(cFieldName [, nWorkArea | cTableAlias] | cFileName)

Return Values

Numeric

Parameters

  • cFieldName
    Specifies the name of the field.

  • nWorkArea
    Specifies the work area of the table for which FSIZE( ) returns a field size.

    FSIZE( ) returns 0 if a table isn't open in the work area you specify.

  • cTableAlias
    Specifies the alias of the table for which FSIZE( ) returns a field size.

    Visual FoxPro generates an error message if you specify a table alias that doesn't exist.

  • cFileName
    Specifies a file for which FSIZE( ) returns the size in bytes.

Remarks

The current setting of SET COMPATIBLE determines if FSIZE( ) returns the size of a field or a file. If SET COMPATIBLE is set to OFF or FOXPLUS (the default), FSIZE( ) returns the size of a field. If SET COMPATIBLE is set to ON or DB4, FSIZE( ) returns the size of a file.

The following table shows the default size (in bytes) for each fixed-length field type.

Field type Default field size(in bytes)
Currency 8
Date 8
DateTime 8
Double 8
Integer 4
Logical 1
Memo 4
General 4

The size of a field can be displayed with DISPLAY STRUCTURE and LIST STRUCTURE.

If you omit the optional nWorkArea and cTableAlias arguments, FSIZE( ) returns the field size for a field in the current table and work area.

Example

The following example uses FSIZE( ) to return the size of two fields in the customer table.

SET COMPATIBLE OFF
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Open Customer table

CLEAR
? FSIZE('contact')  && Displays 30
? FSIZE('cust_id')  && Displays 6

See Also

DISPLAY STRUCTURE | FCOUNT( ) | LIST