A Binary Template usually only reads data from one file at a time and cannot modify any files; however, it is sometimes useful to have a Binary Template read from or write to another file (for example, if a dataset is split across multiple files or to write log files). Templates must be granted permission to read from or write to other files and these permissions can be controlled with the Permission Options dialog, as accessed by clicking 'Tools > Options...' on the menu and selecting Permissions from the list. As one exception, a Template is allowed to create a new file with the FileNew function and write to that file without special permissions (using FPrintf for example), but to save the file to disk the Template must have write permissions.
If the Global Permissions are set to Ask for permission when Templates read or write other files, when a Template attempts to open a file (see FileOpen) the user will be asked to grant read permissions (see the figure below) and if any of the write functions or FileSave is used on a file, the user will be asked to grant write permissions. If the Global Permissions are set to Ask for permissions when Templates read other files, deny when writing files, the user will be asked to grant permissions when attempting to read other files but will automatically be denied when writing to files (the Write Other column will have no effect in the Template Permissions section below). If Global Permissions are set to Deny Templates from reading or writing other files then all read and write operations to other files will automatically be denied and the Template Permissions table below will be ignored.
When no permissions exist for a Template or the permissions are set to Ask and a Template attempts to read from or write to another file, a dialog box such as in the figure above will be displayed. Clicking Allow or Deny will create an entry in the Template Permissions table as explained below. If the operation is denied the Template will be stopped. Clicking Deny All when attempting to read from a file will set the Global Permissions to Deny Templates from reading or writing other files and deny all further read and write operations. Clicking Deny All when attempting to write to a file will set the Global Permissions to Ask for permissions when Templates read other files, deny when writing files and deny all further write operations to other files. Clicking the Cancel button will stop Template execution.
The Template Permissions table at the bottom of the Permission Options dialog display any permissions that were allowed or denied for individual Templates. Additional permissions can be set by clicking the New button and choosing a Template in the standard file dialog box that is displayed. By default, the permissions are set to Ask for ReadOther and WriteOther but can be changed to Allow or Deny by clicking on a permission and using the drop-down list to select a new value. Click the Delete button to remove a permission or the up and down arrows to reorder permissions.
Clicking the Reset button removes all Template Permissions and resets the global permissions to ask for permission for reading or writing.