Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

FileLength – PB Docs 2019 – PowerBuilder Library

FileLength – PB Docs 2019

FileLength

PowerScript function

Description

Reports the length of a file whose size does not exceed 2GB in
bytes.

Syntax

Argument

Description

filename

A string whose value is the name of the file for which you
want to know the length. If filename is not on the current
application library search path, you must specify the fully
qualified name.

Return value

Long.

Returns the length in bytes of the file identified by filename. If
the file does not exist, FileLength returns -1. If filename is null,
FileLength returns null.

Usage

Call FileLength before or after you call FileOpen to check the
length of a file before you call FileRead. The FileRead function can read
a maximum of 32,765 bytes at a time. The length returned by FileLength
always includes the byte-order mark (BOM). For example, suppose the
hexadecimal display of the file SomeFile.txt is FF FE 54 00 68 00 69 00 73
00, then the following statement returns 10,which includes the BOM:

File security

If any security is set for the file (for example, if you are
sharing the file on a network), you must call FileLength before FileOpen
or after FileClose. Otherwise, you get a sharing violation.

The FileLength function cannot return the length of files whose size
exceeds 2GB. Use FileLength64 to
find the length of larger files.

Examples

This statement returns the length of the file EMPLOYEE.DAT in the
current directory:

These statements determine the length of the EMP.TXT file in the
EAST directory and open the file:

The examples for FileRead illustrate reading files of different
lengths.

See also

FileClose

FileLength64

FileOpen

FileReadEx

FileWriteEx


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x