C
Charles Wilkins
given the following code snippet:
int num;
for (; {
cout << "enter number: ";
cin >> num;
//cin.clear();
while (fgets(line, MAXLINE, stdin) != NULL) {
after input is performed by cin, fgets doesnt block whereas if cin was
not called, then fgets would block until it receives input from stdin
how can i set the state of stdin so that after cin is called, fgets
blocks as expected?
Charles
int num;
for (; {
cout << "enter number: ";
cin >> num;
//cin.clear();
while (fgets(line, MAXLINE, stdin) != NULL) {
after input is performed by cin, fgets doesnt block whereas if cin was
not called, then fgets would block until it receives input from stdin
how can i set the state of stdin so that after cin is called, fgets
blocks as expected?
Charles