26 lines
448 B
C
26 lines
448 B
C
/* misc.c */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
void nommer_joueur(char *joueur) {
|
|
char *linefeed_position = NULL;
|
|
|
|
fgets(joueur, 15, stdin);
|
|
|
|
linefeed_position = strchr(joueur, '\n');
|
|
if (linefeed_position != NULL) {
|
|
*linefeed_position = '\0';
|
|
} else {
|
|
vider_buffer();
|
|
}
|
|
}
|
|
|
|
void vider_buffer() {
|
|
int c = 0;
|
|
while((c = getchar()) != '\n' && c != EOF);
|
|
}
|