Re: [go-nuts] ungetc behavior in go

2017-08-14 Thread Doğan Kurt
Thanks it's perfectly clear now. I actually knew that but it didn't look immediately obvious. On Monday, August 14, 2017 at 2:51:13 PM UTC+2, Konstantin Khomoutov wrote: > > On Mon, Aug 14, 2017 at 05:43:04AM -0700, Doğan Kurt wrote: > > > > Consider combining using the bufio package and scanni

Re: [go-nuts] ungetc behavior in go

2017-08-14 Thread Konstantin Khomoutov
On Mon, Aug 14, 2017 at 05:43:04AM -0700, Doğan Kurt wrote: > > Consider combining using the bufio package and scanning form a buffered > > reader using fmt.Fscanf(). > > Great worked like a charm. I just thought i couldn't pass *bufio.Reader to > Fscanf which takes io.Reader. Oh, then that'

Re: [go-nuts] ungetc behavior in go

2017-08-14 Thread Doğan Kurt
> > Consider combining using the bufio package and scanning form a buffered > reader using fmt.Fscanf(). > Great worked like a charm. I just thought i couldn't pass *bufio.Reader to Fscanf which takes io.Reader. -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] ungetc behavior in go

2017-08-14 Thread Konstantin Khomoutov
On Mon, Aug 14, 2017 at 05:09:00AM -0700, Doğan Kurt wrote: > I want to do something analogous to this C code. > > c = getchar() > > if (isdigit(c)) { > ungetc(c, stdin); > scanf("%d", &num); > } > > In fmt package, fmt.Scanf("%d", &num) exists but ungetc doesn't exist. For > bufio package, Pe

[go-nuts] ungetc behavior in go

2017-08-14 Thread Doğan Kurt
I want to do something analogous to this C code. c = getchar() if (isdigit(c)) { ungetc(c, stdin); scanf("%d", &num); } In fmt package, fmt.Scanf("%d", &num) exists but ungetc doesn't exist. For bufio package, Peek function exists which is great but there is no ReadInt. Is there an elegant so