|
Message-Id: <D3NU5IOYGDXP.2OS8STSDBJN0D@icloud.com> Date: Fri, 23 Aug 2024 20:52:50 -0700 From: "Ryan Rhee" <ryanrhee@...oud.com> To: "Rich Felker" <dalias@...c.org> Cc: <musl@...ts.openwall.com> Subject: Re: Possible bug with fputs and fgets mix On Fri Aug 23, 2024 at 7:24 AM PDT, Rich Felker wrote: > This is entirely expected; the fflush is needed. > > The C languages allows, but does not require implementations, to have > a read attempt from an interactive line-buffered device auto-flush all > line-buffered output streams before performing the input. [snip] > As such, musl does not use the allowance to do this, and never > implicitly flushes output streams. Portable programs need to be > prepared for this, and explicitly flush whatever output stream(s) they > want flushed before doing input with a prompt like this. > > (Note that if the prompt ended in a newline, though, just being > line-buffered would have ensured it got flushed. Explicit flushing is > only needed when it doesn't end in a newline or if you're using a > fully-buffered rather than line-buffered output stream.) > > Rich Oh, alright, that's good information to know for the future. Thanks for all this information, and thanks for all the work on the library.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.