fgets into buf directly, rather than the stack