The setvbuf approach also "works" for stdin though the MS docs say:
Quote Originally Posted by http://msdn.microsoft.com/en-us/library/86cebhfs(VS.100).aspx
stream must refer to an open file that has not undergone an I/O operation since it was opened.
Though it hasn't been enforced in any way since at least VC6.