Paste number 24582: cout flushes because of cin

Paste number 24582: cout flushes because of cin
Pasted by: Korollary
When:3 years, 5 months ago
Share:Tweet this! | http://paste.lisp.org/+IYU
Channel:#haskell
Paste contents:
Raw Source | XML | Display As
#include <iostream>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
using namespace std;

int main(void)
{
    cout << "> ";
    int i = 0;
    cin >> i; // comment this out and it doesn't flush
    struct timeval tv;
    tv.tv_sec = 5;
    select(0, NULL, NULL, NULL, &tv);
    cout << i << endl;

    return 0;
}

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.