Copy stdin to stdout: Difference between revisions

Content added Content deleted
Line 689: Line 689:


=={{header|VBScript}}==
=={{header|VBScript}}==
VBScript can't get single chars from stdin, so we have to implement it line to line. Ctrl-Z stops.
VBScript can't get single chars from stdin, so we have to implement it line to line. Ctrl-Z+Enter stops.
<lang vb>
<lang vb>
do
do
Line 696: Line 696:
loop until asc(left(s,1))=26
loop until asc(left(s,1))=26
</lang>
</lang>
=={{header|Wren}}==
In the following script, stdin and stdout are both assumed to be connected to a terminal.

Bytes are read from stdin and written to stdout until the return key is pressed.
<lang ecmascript>import "io" for Stdin, Stdout

Stdin.isRaw = true // prevents echoing to the terminal
while (true) {
var byte = Stdin.readByte() // read a byte from stdin
if (byte == 13) break // break when enter key pressed
System.write(String.fromByte(byte)) // write the byte (in string form) to stdout
Stdout.flush() // flush output
}
System.print()
Stdin.isRaw = false</lang>

=={{header|Wren}}==
=={{header|Wren}}==
In the following script, stdin and stdout are both assumed to be connected to a terminal.
In the following script, stdin and stdout are both assumed to be connected to a terminal.