[vox-tech] a better scanf?? (C-programming question)

Micah J. Cowan vox-tech@lists.lugod.org
Thu, 17 Apr 2003 19:40:07 -0700


On Thu, Apr 17, 2003 at 11:42:09AM -0700, Andy Campbell wrote:
> Hello all,
>  
> Does anyone know of a better input mechanism from stdin than scanf?? I
> need the functionality of scanf, without stopping the program flow. In
> other words, is there a function that will store any keyboard info into
> a buffer, and then continue with the program until next time the loop
> executes and it sees what (if anything) has been put into the buffer,
> and stores the buffer contents once the carriage return is input??
>  
> I basically need a scanf that doesn't halt the program?? The only thing
> I have found is "bioskey" but I think that that is only in a dos
> environment??

I'd recommend fgets() combined with sscanf().

-Micah