title: How do i use fgetc with gcc compiler
body: <p>I am trying to get 2 inputs from a user:</p>
  
  <p>the first one is a size which i get using scanf.
  the next input is a string of unknown size,
  and the problem is that the first char on the input is the "enter" the user pressed from the line before therefor i dont get an input at all.
  I will just note that on visual studio its completely fine! the problem is only on my mac and on my friends linux.
  here is the code:</p>
  
  <pre><code>int main()
      {
          int size;
          char* inputString;
          printf("Enter the number of computers:");
          scanf("%d", &amp;size);
          if (size == 1)
          {
              printf("Only one computer\n");
              return;
          }
      inputString = malloc(stringSize);
      inputString = inputStrings(stdin, stringSize);
   }
  char *inputStrings(FILE* fp, int size)
  {
      //The size is extended by the input with the value of the provisional
      char *str;
      int ch = 0;
      int len = 0;
      str = realloc(NULL, sizeof(char)*size);//size is start size
      if (!str)return str;
      while (EOF != (ch = fgetc(fp)) &amp;&amp; ch != '\n')
      {
          str[len++] = ch;
          if (len == size)
          {
              str = realloc(str, sizeof(char)*(size += 16));
              if (!str)return str;
          }
      }
      str[len++] = '\0';
  
      return realloc(str, sizeof(char)*len);
  }
  </code></pre>