Input ##### Comefrom0x10 programs can receive input from all the normal places, standard input, files and the command line. Command-line arguments ********************** The global ``argv`` stores command-line arguments to Cf0x10 programs. This example echoes its command line arguments:: # In the file echo.cf0x10 argv Invoked thus: .. code-block:: shell cf0x10 echo.cf0x10 hello world Prints ``hello world``. Standard input ************** This example prompts for input from the user and exits when the user enters a blank line:: prompt comefrom echo 'Type something: '... stdin = '' echo comefrom stdin if stdin 'You typed "' stdin '"' # jumps back to prompt Input is blocking and line-buffered. Changing the ``stdin`` global causes the program to wait for input, so it actually pauses at the line ``stdin = ''``, until stdin is set. Each line automatically gets its trailing newline dropped (automatically chomped, in Perl-speak). End-of-file (EOF) sets stdin to ``undefined``, so a Cf0x10 program can trivially detect the end of piped input. Files ***** Setting the ``read_path`` global causes a read from the given path, whose contents will be stored in the ``file`` global. This cat program reads a single file and prints its contents to standard out:: read_path = argv file Setting the ``write_path`` global causes the contents of the ``file`` global to be written to ``write_path``. This program writes "Hello, world" to a path given on the command line:: file = 'Hello, world' write_path = argv Because Cf0x10 has no binary data type, files are always encoded and decoded as UTF-8.