[erlang-questions] Flush "stdout" buffer

Frank Muller <>
Sat Sep 2 08:42:43 CEST 2017


Hi Per,

Hmmm ... So If i understand it well, we've no control on that after all.

The data can still be buffered on the kernel side.

Thanks
/Frank

Le ven. 1 sept. 2017 à 14:58, Per Hedeland <> a écrit :

> On 2017-09-01 13:58, Frank Muller wrote:
> > Can someone help on this please?
>
> Well, what is the problem that you want to solve? Erlang doesn't really
> have an equivalent to C stdio, and anything you write with io:format/1,2,3
> to "standard output" is sent immediately to the OS via a write(2) (or
> typically writev(2)) call. Are you seeing something else?  Try this:
>
> erl -noshell -eval 'io:format("foo
> "),timer:sleep(2000),io:format("bar~n"),timer:sleep(2000),erlang:halt(0)'
>
> --Per
>
> > Thanks
> > /Frank
> >
> > Le mer. 30 août 2017 at 07:21, Frank Muller <
> <mailto:>> wrote :
> >
> >     Hi Prakash,
> >
> >     Thanks, but I doubt it's that easy.
> >
> >     In C, you've to call fflush or set the stdout to unbuffer mode.
> >
> >     /Frank
> >
> >     Le mer. 30 août 2017 à 06:51, Prakash Parmar <
>  <mailto:>> wrote
> :
> >
> >         Hi Frank,
> >
> >         As per my experience, Like in C, keeping newline "~n" in
> io:format will flush it to screen.
> >
> >         /Prakash
> >
> >         -----Original Message-----
> >         From: "Frank Muller" < <mailto:
> >>
> >         Sent: Wednesday, August 30, 2017 9:58am
> >         To: "Erlang-Questions Questions" <
> <mailto:>>
> >         Subject: [erlang-questions] Flush "stdout" buffer
> >
> >         Hi guys,
> >         I'd like to know if there's an equivalent function to C
> fflush(stdout) ?
> >         I've a small Erlang program which prints data to stdout. After
> every io:format call, I'd like to ensure output is flushed to screen.
> >         Thanks in adavance.
> >         /Frank
> >
> >
> >
> >         ******* DISCLAIMER: This email and any files transmitted with it
> are privileged and confidential information and intended solely for the use
> of the individual or entity to which they are
> >         addressed. If you are not the intended recipient, please notify
> the sender by e-mail and delete the original message. Further, you are not
> to copy, disclose, or distribute this e-mail or its
> >         contents to any other person and any such actions are unlawful.
> This e-mail may contain viruses. Torry Harris Business Solutions has taken
> every reasonable precaution to minimize this risk,
> >         but is not liable for any damage you may sustain as a result of
> any virus in this e-mail. The recipient should check this email and any
> attachments for the presence of viruses. THBS reserves
> >         the right to monitor and review the content of all messages sent
> to or from this e-mail address********
> >
> >         ******* DISCLAIMER: This email and any files transmitted with it
> are privileged and confidential information and intended solely for the use
> of the individual or entity to which they are addressed. If you are not the
> intended recipient, please notify the sender by e-mail and delete the
> original message. Further, you are not to copy, disclose, or distribute
> this e-mail or its contents to any other person and any such actions are
> unlawful. This e-mail may contain viruses. Torry Harris Business Solutions
> has taken every reasonable precaution to minimize this risk, but is not
> liable for any damage you may sustain as a result of any virus in this
> e-mail.  The recipient should check this email and any attachments for the
> presence of viruses. THBS reserves the right to monitor and review the
> content of all messages sent to or from this e-mail address.********
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170902/8c1c590b/attachment.html>


More information about the erlang-questions mailing list