Hm... seems I missed this one.
I wouldn't go as far as reimplementing scanf() (which is inviting even more trouble if you ask me). All you have to do is, skip over everything in the stdin queue that you don't want to be there. If that means "everything" (and usually, it doesn't), you can just [tt]while( getchar() != EOF )[/tt].
If you expect - and want to skip - whitespaces, use that space-prepended scanf() I recommended earlier, and make sure that you use a scanf() without leading whitespace on first reading. (As this skips over either spaces, tabs, and newlines, and the one doing the input has to seperate his inputs in some way, that is usually what you want to do.)
If you want to become more sophisticated - like, skipping until the next uppercase character appears - you can use getchar() and ungetc() to "clean" stdin before doing the next scanf():
int c;
while ( ! isupper( c = getchar() ) );
ungetc( c );
Voila, the first uppercase character is still in stdin, and everything before it has been skipped. (Of course, production code must be a bit more elaborate, as you would have to check for EOF, too.)
Just don't try to reimplement scanf(). Unless you know exactly what you're doing, you'll get into even
more trouble - and if you knew, we wouldn't be in this thread.