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 declare no-default-io to any program that will be invoked in an environment where standard I/O is not available. Note that declare no-default-io 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 used, declare no-default-io must appear before any rule, function definition, or global shelf declaration.

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

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

When using declare 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

AltStyle によって変換されたページ (->オリジナル) /