Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!apple!portal!cup.portal.com!tms From: tms@cup.portal.com (Taos Mountain Software) Newsgroups: comp.lang.c Subject: how do I clear stdin buffer Message-ID: <43310@cup.portal.com> Date: 14 Jun 91 18:45:32 GMT Organization: The Portal System (TM) Lines: 22 The stdio function "scanf" works great for input from datafiles, but I always run into problems when doing interactive tty I/O on Unix systems. For example, this simple program will go into an infinite loop if the entry is a non-digit for example ("abc"). main () { int x,stat;; do { stat=scanf("%d",&x); } while (stat != 1); ... ... } I know there are plenty of workarounds, but what I'm interested in is a function like fflush that deals with input streams. Thanks in advance Ric Urrutia tms@cup.portal.com