TP 13 exo1: Implement all the required features.
[TD_C.git] / TP_13 / exo1 / lib / utils.c
index 04a20e4e1ed363eb9d7cd229967423bddd4faf50..fbd7e01fa7d9a1b9cde178b4da7207f27c8b4f97 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #include "utils.h"
 
 void swap_int(int* v1, int* v2) {
@@ -11,3 +13,11 @@ void swap_ptr(void* v1, void* v2) {
     v1 = v2;
     v2 = tmp;
 }
+
+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);
+    }
+}