[erlang-questions] Flush "stdout" buffer

Michael Truog <>
Sat Sep 2 10:07:23 CEST 2017


On 09/01/2017 04:58 AM, Frank Muller wrote:
> Can someone help on this please?
>
If you use stdout as an Erlang port like:

STDOUT =  erlang:open_port({fd, 0, 1}, [out, {line, 256}]),
erlang:port_command(STDOUT, "unbuffered").

Then you don't need to flush stdout and you could probably flush stdout by just using erlang:port_command(STDOUT, "").  Doing output this way bypasses the io server and is useful for doing things like progress bars in Erlang source code.

Best Regards,
Michael


More information about the erlang-questions mailing list