fsize is available since version 1.0.
Prototype:
number fsize(number fd)
Parameters
fd
[in] A valid file descriptor
Description:
Gets the file length, in bytes, of the target file.
Return value:
Returns the file length, in bytes, of the target file
Example
import standard.C.io
define FILENAME "test.txt"
class Main {
function Main() {
if(!(var fd = fopen( FILENAME, "r" )))
echo "The file " + FILENAME + " was not opened\n";
else {
var buffer = "";
fread(buffer, 1, fsize(fd), fd);
echo buffer;
fclose(fd);
}
}
}
Results
Content of the file