title: fgets from stdin problems [C]
body: <p>I'm writing a program that works with files.
  I need to be able to input data as structures, and eventually read it out.
  The problem i have at the moment is with this code:</p>
  
  <pre><code>typedef struct {
      char* name;
      .....
  }employeeRecord;
  employeeRecord record;
  
  char name[50];
  
  if(choice == 1)
      {
          /*Name*/
          printf("\nEnter the name:");
          fgets(name,50,stdin);
          record.nameLength = strlen(name) -1;
          record.name = malloc(sizeof(char)*record.nameLength);
          strcpy(record.name,name);
          /*Other data, similar format...*/
  </code></pre>
  
  <p>If i want for example, name address and phone number, and ask for each in a row (so address is pretty much identical to above except replacing 'name' with address), i find it skips the input. What i mean is, I am given no chance to input it. The output is actually
  Enter the name:
  Enter the address: (and here is where it prompts me for input)</p>