Army1987 said:
>
> "Richard Heathfield" ha scritto...
<snip>
>> if(fgets(Yes_No, sizeof Yes_No, stdin) != NULL && Yes_No[0] == 'y')
>
> Is it necessary?
No, of course not. There are plenty of ways you could do this...
> I'd just use:
> int answer;
> int ch;
>
> and then:
> answer = getchar();
> do {
> ch = getchar();
> } while (ch != '\n' && ch != EOF);
> if (answer == 'y' || answer == 'Y') {
....for example, you could write five lines of code instead of one, and
still fail to deal with EOF correctly.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.