title: How to use scanf in a loop to read data until a EOL?
body: <p>the problem I have is as follows:</p>
  
  <p>I need to create a function in C, using the standard libraries.
  This function should read data from standard input as follows: value1 value2 value3</p>
  
  <p>Whose type is uint32_t.</p>
  
  <p>The problem is that I do not like that much data going to enter, I can just finish reading the data when the user enter a line that does not respect the format given, or when entering a line with spaces or when entering an EOF.</p>
  
  <p>I was reading several answers to similar problems in the page and this is the code that I did:</p>
  
  <pre><code>int main(void) {
  uint32_t value1, value2, value3;
  int ret = 3;
  char ch;
  while (true) {
      printf("Enter the data:\n");
      ret = scanf("%u %u %u", &amp;value1, &amp;value2, &amp;value3);
      if ((ret != 3) || (getc(stdin) == EOF) ||
          (getchar() == ' ')) {
          break;
      }
      printf("\nYou entered: %u, %u, %u\n", value1, value2, value3);
  }
  printf("Finish..");
  return 0;
  }
  </code></pre>
  
  <p>But not working properly.</p>
  
  <p>Any suggestions?</p>