X-Git-Url: https://git.piment-noir.org/?p=TD_C.git;a=blobdiff_plain;f=TP_13%2Fexo1%2Flib%2Fio.c;h=69b13d768f2b68e4cd0a01e01f2e23ab30a8368a;hp=e5a300070d24305638d8f140b866b480950a93d6;hb=04b0afb5d5c81f1d98e98b9a6e532b1d3c868cc4;hpb=506ed8ed2ccf2fce58e9a0dd651e4ceea5a6320c diff --git a/TP_13/exo1/lib/io.c b/TP_13/exo1/lib/io.c index e5a3000..69b13d7 100644 --- a/TP_13/exo1/lib/io.c +++ b/TP_13/exo1/lib/io.c @@ -1,9 +1,9 @@ +#include #include #include #include "io.h" #include "array.h" -#include "utils.h" int prompt_value(const char* msg, int* result) { puts(msg); @@ -108,6 +108,14 @@ void do_resize(int array[], unsigned* old_size) { *old_size = new_size; } +void handle_prompt_error(int errno) { + if (errno != 0) { + printf("\nMerci de saisir un nombre entier, exiting\n"); + /* it's somewhat violent but better than looping forever */ + exit(EXIT_FAILURE); + } +} + void display_array(int array[], unsigned size) { if (array != NULL) { printf("\n--array begin--\n");