On Wed, Aug 30, 2017 at 12:52 AM,  <nilsoc...@gmail.com> wrote:
>
> I have seen that python input and output is buffered, but golang's input and
> output is not buffered.
>
> For those types of problems where i need to take large amounts of input,
> It's taking long time to just take input than to do processing.
> When we have advantages with buffered input and output, why isn't it input
> taken in such a way while I'm using scanf function.
> or else am I supposed to use bufio package whenever I want to take buffered
> input and buffered output.

It's true that fmt.Scanf works on the unbuffered os.Stdin.  That is
the correct choice when os.Stdin is used for different things.  For
your case, use bufio.NewReader(os.Stdin) and passed the buffered
stream to fmt.Fscanf.  Then of course you must make sure to always use
the buffered input stream, but plain os.Stdin.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to