openTps function

TpsReader openTps(
  1. String path, {
  2. String? password,
  3. Encoding encoding = windows1252,
  4. int cachePages = 64,
})

Opens the .tps file at path for reading a few pages at a time. See TpsReader for the arguments; call TpsReader.close when done.

The file is opened read-only and never locked, so a Clarion program can keep using it. While it writes, use readTps instead.

Throws FileSystemException when the file cannot be opened and TpsException when it is not a readable TopSpeed file.

Implementation

TpsReader openTps(String path,
    {String? password, Encoding encoding = windows1252, int cachePages = 64}) {
  final source = TpsFileSource.open(path);
  try {
    return TpsReader(source,
        password: password, encoding: encoding, cachePages: cachePages);
  } catch (_) {
    source.close();
    rethrow;
  }
}