Gets the current logical length of the file.
Syntax: |
---|
DlxFile.GetLength() |
Return Value
For binary files it returns the current logical length of the file in bytes. For text files it returns the current logical length of the file in characters.
Example
Copy code | |
---|---|
var filename = "demofile.txt";
// write file
var file = new DlxFile(filename, DlxApp.FILEOPEN_WRITETEXT);
if (file.IsValid())
{
for (var i = 0; i <= 90; i++)
file.Write(i.toString() + "° : " + Math.sin(i / 180 * Math.PI) + "\n");
file.Close();
}
// read file
file = new DlxFile(filename, DlxApp.FILEOPEN_READTEXT);
if (file.IsValid())
{
DlxApp.Printf("Reading file: %s", file.GetFilePath());
DlxApp.Printf("File size: %i characters", file.GetLength());
file.Close();
}
else DlxApp.Printf("File not found.");
|