~ecs/tbrace

tbrace/helpers.c -rw-r--r-- 246 bytes
f007a19d — Eyal Sawady Makefile: rewrite 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>

int
fgetint(char *prompt, FILE* file)
{
	int n;
	printf("%s", prompt);
	fflush(stdout);
	while (fscanf(file, "%d", &n) != 1) {
		printf("Try again. %s", prompt);
		fflush(stdout);
		while (getchar() != '\n');
	}
	return n;
}