Obtains the current value of the file pointer, which can be used in later calls to Seek.
Syntax: |
---|
DlxFile.GetPosition() |
Return Value
The file pointer.
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("File size: %i characters", file.GetLength());
file.Seek(file.GetLength() /2, DlxApp.FILESEEK_BEGIN);
DlxApp.Printf("Position; %i", file.GetPosition());
while (!file.IsEOF())
DlxApp.Printf("-: %s", file.ReadLine());
DlxApp.Printf("Position; %i", file.GetPosition());
file.Close();
}
else DlxApp.Printf("File not found.");
|