Copy stdin to stdout: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 696: | Line 696: | ||
loop until asc(left(s,1))=26 |
loop until asc(left(s,1))=26 |
||
</lang> |
</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. |
||
Line 712: | Line 713: | ||
Stdin.isRaw = false</lang> |
Stdin.isRaw = false</lang> |
||
=={{header| |
=={{header|XPL0}}== |
||
Device 1 is stdin without echoing a character to the screen. Device 0 (or 1) is |
|||
In the following script, stdin and stdout are both assumed to be connected to a terminal. |
|||
stdout, which displays the character on the monitor. This program can |
|||
list a file to the screen like this: stdio <file.txt |
|||
Bytes are read from stdin and written to stdout until the return key is pressed. |
|||
<lang XPL0>int C; |
|||
<lang ecmascript>import "io" for Stdin, Stdout |
|||
loop [C:= ChIn(1); |
|||
if C = $1A \EOF\ then quit; |
|||
Stdin.isRaw = true // prevents echoing to the terminal |
|||
ChOut(0, C); |
|||
while (true) { |
|||
]</lang> |
|||
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|zkl}}== |
=={{header|zkl}}== |