Xbasic

FILE.BYTES_GET Function

Syntax

Byte_Count as N = file_pointer.Bytes_get()

Returns

Byte_CountNumeric

Returns the number of bytes in the file.

Description

Get the length of the file in bytes.

Discussion

The .BYTES_GET() method returns the number of bytes in a file referenced by the file object pointer.

Example 

This script returns the size (in bytes) of the selected file.

filename = ui_get_file("Choose File", "Text File(*.txt)", "C:\a5\default.txt", "X")
file_pointer = FILE.open(filename, FILE_RO_SHARED)
bytes = file_pointer.bytes_get()
trace.writeln("Bytes:" + str(bytes))
file_pointer.close()

See Also