Copy stdin to stdout: Difference between revisions

Content added Content deleted
(Add 8086 assembly)
(Add Scala)
Line 382: Line 382:
io::copy(&mut io::stdin().lock(), &mut io::stdout().lock());
io::copy(&mut io::stdin().lock(), &mut io::stdout().lock());
}</lang>
}</lang>

=={{header|Scala}}==

For Scala 2's compiler <code>scalac</code>, a containing object is required:

<lang Scala>object CopyStdinToStdout extends App {
io.Source.fromInputStream(System.in).getLines().foreach(println)
}</lang>

If it's being run directly by <code>scala</code>, it can be shortened to one line, and run directly in the shell:

<lang bash>scala -e "io.Source.fromInputStream(System.in).getLines().foreach(println)"</lang>


=={{header|Scheme}}==
=={{header|Scheme}}==