so that is why gets(buffer); is so dangerous? Because unlike fgets(buffer,sizeof buffer,stdin); does not have the size of the buffer?

Also a question I have been thinking about is. If you have insured that the buffer can't be overwritten then you wouldn't be much concerned by someone sending a huge amount of data to stdin because the OS would handle that wouldn't it? The only consideration would be to clear the junk out of stdin before getting more input correct?? How do you know if that is the case. I know if you check the stdin for data and it's empty it will just sit and wait for data before continuing. So how can you check stdin without the pause when it's empty?? Or should the question be after using fgets how does one know if extra data was input?