#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <glib/gprintf.h>

/* EXO 1.5 */

int main(int argc, char* argv[]){
  g_printf(" === EXO 1.5  === \n");
  g_printf("Saisir une valeur entre 1 et 10 : \n");
  GIOChannel *channel = g_io_channel_unix_new (STDIN_FILENO);
  gchar *str;
  g_io_channel_read_line (channel, &str, NULL, NULL, NULL);
  gint64 val = g_ascii_strtoll(str, NULL, 10);


  gint64 newval = CLAMP(val,0,10);

  g_printf ("Valeur = %d  \n", newval); 
  
  return EXIT_SUCCESS;
}
