I believe the terminal buffers every line of text received through the keyboard, such that any program which has a file descriptor (i.e. fd0) attached to the terminals device file - won't see any text from the line until the terminal "sends" it - which happens when you press Enter.
(How the line editors of shells get around this - I'm not sure, but they definitely get at the text before you hit Enter)
Also when a shell launches a child process (in this case ping) it goes into in a suspended/waiting state as the child process runs, so even if the terminal wasn't withholding text from it, the shell would ignore it, assuming it was intended for the child process.
So the text you see appearing on the screen, is because the terminal is displaying it, but there is no program capturing it and doing anything with it, until the child exits - and the shell "wakes up' - then the text is sent to the shells line editor. Although I don't think all terminals necessarily do that.
Cthat executesping, and so whenpingterminates, my program gain back control, what function should I call to get what was typed whilepingwas running (to get data from this queue)? – paul May 21 '17 at 11:54bash --noeditingorset +o emacsin the current shell. I have discovered following: typed characters don't appear in the end, but you can remove part of prompt string by quantity typed characters, for example: type 6 characters, whilepingis working, then press backspace 6 times~/Documents/test_dir$transforming to~/Documents/tes. – MiniMax May 24 '17 at 13:24