From: Rudi Cilibrasi Date: 2007-10-04T07:31:53+09:00 Subject: Re: Non-blocking 'gets' ? On 10/3/07, 7stud -- wrote: > Stephen Ware wrote: > One thing I found puzzling is having to call STOUT.flush. When I don't > include that statement, then the print statement is skipped. Yet, if I > use puts instead of print, then the flush call isn't necessary. Anyone > know why? I guess it's because in Unix most text I/O at the text console is line-buffered by default. See "cooked mode" e.g. http://meshier.com/docs/oreilly/unix2/upt/ch41_02.htm for more info. Roughly, the kernel is expected to collect input into lines, and to allow stuff like backspace to work simply, it has to buffer a whole line up and wait for return before sending it on to the application. So that is why your print doesn't print: it is not sending the return to cause the flush. But sending one yourself fixes it. The puts has the \n so the flush happens automatically I guess. -- "We can try to do it by breaking free of the mental prison of separation and exclusion and see the world in its interconnectedness and non-separability, allowing new alternatives to emerge." -- after Vandana Shiva