View Single Post
Old Jun 1st, 2006, 3:06 PM   #18
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
>Then told to use cin.sync(), and it "worked".
This is one of the grey areas. The C++ standard in no way implies that cin.sync() will do what most people expect when they want to "flush" the stream. Unfortunately, many compilers implement it so that it does, and even Stroustrup explicitly (and incorrectly) states that it flushes the stream. The best solution is to avoid it entirely in favor of other solutions that are guaranteed to work as expected.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote