Julia's vision on input/output (I/O) is stream-oriented, that is, reading or writing streams of bytes. We will introduce different types of stream, file streams, in this chapter. Standard input (stdin) and standard output (stdout) are constants of the TTY type (an abbreviation for the old term, Teletype) that can be read from and written to in Julia code (refer to the code in Chapter 8\io.jl):
- read(stdin, Char): This command waits for a character to be entered, and then returns that character; for example, when you type in J, this returns 'J'
- write(stdout, "Julia"): This command types out Julia5 (the added 5 is the number of bytes in the output stream; it is not added if the command ends in a semicolon ;)
stdin and stdout are simply streams and can be replaced by any stream object in read/write commands. readbytes is...