no-default-io

declaration/definition

Syntax
declare no-default-io


Purpose

If an OmniMark program is invoked in an environment in which standard error, standard input, and standard output are not available, you will receive a runtime error if you attempt to read standard input or to write to standard output or standard error. If you include the no-default-io declaration in your program, however, attempts to use these standard I/O mechanisms will be flagged as compile time errors. We recommend that you add a no-default-io declaration to any program that will be invoked in an environment where standard I/O is not available. Note that the no-default-io declaration applies to attempts to read #main-input and #process-input and attempts to write to #main-output, #process-output, and #error. It cannot detect attempts by external functions to write to standard I/O.

When using no-default-io, #current-output and #current-input do not become available until explicitly connected by the program, as shown in this example:

  declare no-default-io
  
  global stream in-file
  global stream out-file
  
  process
  
     set in-file to file "inputfile"
     open out-file as "outputfile"
  
     using input as in-file
        using output as out-file
           submit #current-input
  
     close out-file

A no-default-io declaration cannot be used in aided translation type programs (cross-translate, up-translate, down-translate, and context-translate).

A no-default-io declaration cannot be used in a module.