Date: Fri, 24 May 2002 14:46:22 +0300 From: Giorgos Keramidas <keramida@FreeBSD.org> To: echo dev <echo_dev@hotmail.com> Cc: hackers@FreeBSD.org Subject: Re: your mail Message-ID: <20020524114622.GA857@hades.hell.gr> In-Reply-To: <F107VCxPcnietfhTGBe00009c91@hotmail.com> References: <F107VCxPcnietfhTGBe00009c91@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020524114622.GA857>
