C++ equivalent to fflush(stdin)

Discussion in 'Software' started by ShockTroop, Jan 25, 2007.

  1. ShockTroop

    ShockTroop Specialist

    I've been trying to find a C++ equivalent to C's fflush(stdin), but none seem to work. cin.ignore(), cin.ignore(x), cin.ignore (x,'\n'), and cin.clear() don't work for a simple cin>>x when I input characters. It's not the attempt to convert chars to an int because I've tested and error handled that portion. I think for some reason there's still a '\n' or something floating around in the buffer that I can't seem to get rid of.
    I'd prefer not to use C for the sake of consistency, but if there's no equivalent I guess I have no choice.
    Any ideas?
    Thanks!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds