Reads data from a file from the current file position.

syntaxSyntax:
DlxFile.ReadNext(count = 1)

Parameters

Parameter Description
count Number of characters to read.

Return Value

If the operation finishes successfully, it returns the text string, otherwise it returns an empty string.

Remarks

If the file is of binary type (opened with DlxApp.FILEOPEN_READBINARY) only the byte at the current location is read, and the location is incremented according to the value of count.

Example

  Copy codeCopy code
var filename = "demofile.txt";
// write file
var file = new DlxFile(filename, DlxApp.FILEOPEN_WRITETEXT);
if (file.IsValid())
{
  file.Write("0123456789");
  file.Close();
}
// read file
file = new DlxFile(filename, DlxApp.FILEOPEN_READTEXT);
if (file.IsValid())
{
  DlxApp.Printf("File size: %i characters", file.GetLength());
  while (!file.IsEOF())
    DlxApp.Printf("-: %s", file.ReadNext(2));
  file.Close();
}
else DlxApp.Printf("File not found.");

See also