tests: convert misc-memcpy.c to C++

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc/stdio: Flush stdout on read from stdin

Fix read from stdin to flush stdout. This happens in Linux (glibc) and
in traditional UNIX, although it was never guaranteed by any standard.

This behavior was added in UNIX because it was useful for programs which
print a prompt and read input - forgetting to fflush(stdout) in the meantime.
It was later done to Linux to run programs which assumed it, and for the
same reason we also want it in OSv.

Fixes #464.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>