[Toybox] Should xprintf call fflush?
Isaac Dunham
ibid.ag at gmail.com
Mon Feb 3 15:25:48 PST 2014
I've been running into some unexpected behavior, mainly with fdisk.
Specifically, the issue is that the prompt is sometimes not written until
after I enter a response; then, I might get two prompts at once.
When I looked at the code, the prompt was output using xprintf before
anything was read.
I added an fflush() after the xprintf and it solved the issue.
So I'm wondering:
If we want to make sure that a call to printf() succeeds,
wouldn't it make sense to make sure that it writes its output at that time?
The way to do this would be calling fflush() in xprintf().
Thanks,
Isaac Dunham
More information about the Toybox
mailing list