The first line writes "hello world" to the file "output", the second reads it back and writes it to standard output (normally the terminal). A "here" document is essentially a temporary, nameless file ...
I have a C program, and want to run some other program ("ftp", if you must know). I also want to be able to feed commands (like "open <hostname>") into ftp's stdin. However, my attempts haven't been ...