Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Opened
sales@elliecomputing.com - Contact us


System.Console object

 

 

Prototype for System.Console objects

Syntax

A System.Console global object is created for you and only this object can exist in the application. It is named System.Console and is globally accessible, you can also access its properties directly.

Parameters

none.

Property Of

System object.

Implemented In

ECMerge 2.1.78

Description

 This object let you read from standard input and write text to standard output and error streams.

Properties

Property Description
error_encoding Encoding string. Encoding in which text is converted before being written to error stream.
input_encoding Encoding string. Encoding from which text is converted when read from input stream.
output_encoding Encoding string. Encoding in which text is converted before being written to output stream.

 

Methods

beep
readline
write / write_error

Examples

Example 1.

The following code reads all the lines of input text in SJIS encoding and dumps it as UTF-8 to standard output:

var line;
System.Console.intput_encoding="SJIS";
System.Console.output_encoding="UTF-8";
while (line = System.Console.readline(true))
    System.Console.write(line);

See Also 

 Encoding string, System object

Method beep

Syntax

function beep ( )
no return value

Parameters

 none

Method Of

System.Console object.

Implemented In

ECMerge 2.2.111

Description

Emits the standard "ding" of your system. Note that on Windows, if you instructed the system to not emit the default system sound (Silent mode), nothing is emitted.

Examples

Example 1.

Makes a beep:

System.Console.beep()

Method readline

Syntax

function readline (keep_end_of_line)
returns a String

Parameters

keep_end_of_line. Boolean. Defaults to false. If true, the end of line marker is kept. Note that when reading lines which may be empty, it is the only way to know that you reached the end of input stream.

Method Of

System.Console object.

Implemented In

ECMerge 2.1.78

Description

Reads a line of text from standard input and returns it to the caller. The input text is interpreted as specified by System.Console.input_encoding, it is then transformed to Unicode text internally.

Examples

Example 1.

This example reads the first line of text in the input stream, without line terminator.

var first_line = System.Console.readline();

See Also 

 input_encoding property.

Methods write and write_error

Syntax

function write (text [, text [...]])
function write_error (text [, text [...]])
no return values

Parameters

text. String. Text to be written to output or error stream. You can put several text per call which avoids the performance hit due to unnecessary concatenation before writing to a stream

Method Of

System.Console object

Implemented In

ECMerge 2.1.78

Description

Writes text to standard output or error streams. Text is converted into output_encoding or error_encoding encodings respectively, then the obtained binary representation is written to the respective standard stream.

Examples

Example 1.

This sample writes number from 1 to 10 to standard output, each followed by a DOS line terminator:

for (var i=1; i<=10; ++i)
    System.Console.write (i, "\r\n");

See Also 

 output_encoding property, error_encoding property.