From owner-freebsd-hackers Fri May 24 5: 4:40 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id 9707F37B404 for ; Fri, 24 May 2002 05:04:34 -0700 (PDT) Received: from hades.hell.gr (patr530-b156.otenet.gr [212.205.244.164]) by mailsrv.otenet.gr (8.12.3/8.12.3) with ESMTP id g4OC4T6H005496; Fri, 24 May 2002 15:04:31 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.3/8.12.3) with ESMTP id g4OC4NRX001129; Fri, 24 May 2002 15:04:28 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.3/8.12.3/Submit) id g4OBkMTI000943; Fri, 24 May 2002 14:46:22 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 24 May 2002 14:46:22 +0300 From: Giorgos Keramidas To: echo dev Cc: hackers@FreeBSD.org Subject: Re: your mail Message-ID: <20020524114622.GA857@hades.hell.gr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.99i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-05-23 22:38, echo dev wrote: > Now the problem is when the player answers it correctly it ouputs > would you like to play again.. When it prompts for your answer it > automaicly acwers it self. > scanf("%c", &qNa); > printf("WOULD YOU LIKE TO PLAY AGAIN?(y/n)>"); > scanf("%c", &qNa); Just don't use scanf(). Read a line of text and parse it on your own. Something like: #define BUFLEN 512 char buf[BUFLEN]; if (fgets(buf, BUFLEN, stdin) == NULL) { if (ferror(stdin)) /* Handle errors. */ ; else if (feof(stdin)) /* End of file, quit or something. */ ; } -- Giorgos Keramidas - http://www.FreeBSD.org keramida@FreeBSD.org - The Power to Serve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message