title: C program core dumped when writing to a file
body: <p>I am new to C program and I am working on a program which is writing a set of struct to a .txt file. </p>
  
  <p>This is my try:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  struct FileSig {
      char name[256];  
      char mode;   
      char user_id;   
      char group_id;   
      char size;  
      char time_last_mod[50]; 
  };
  
  
  int main(int argc, char **argv)
  {
      struct FileSig FileSig1;
      FILE *fp_Out;
      fp_Out = fopen( "out.txt" , "w" );
  
      printf("Enter name: ");
      scanf("%s", FileSig1.name);
      fprintf(fp_Out, "Name: %s\n", FileSig1.name);
  
      printf("Enter mode: ");
      scanf("%s", FileSig1.mode);
      fprintf(fp_Out, "Mode: %s\n", FileSig1.mode); 
  
      printf("Enter user id: ");
      scanf("%s", FileSig1.user_id);
      fprintf(fp_Out, "userID: %s\n", FileSig1.user_id); 
  
      printf("Enter group id: ");
      scanf("%s", FileSig1.group_id); 
      fprintf(fp_Out, "groupID: %s\n", FileSig1.group_id); 
  
      printf("Enter size: ");
      scanf("%s", FileSig1.size);
      fprintf(fp_Out, "size: %s\n", FileSig1.size);  
  
      printf("Enter time last modifly: ");
      scanf("%s", FileSig1.time_last_mod);
      fprintf(fp_Out, "time_last_mod: %s\n", FileSig1.time_last_mod);  
  
  //  fp_Out = fopen( "out.txt" , "w" );
  //  fprintf(fp_Out, "Name: %s\nMode: %d\nUserID:%d\nGroupID: %d\nSize:%d\nTime last modifly:%s", FileSig1.name, FileSig1.mode, FileSig1.user_id, FileSig1.group_id, FileSig1.size, FileSig1.time_last_mod);
  
      fclose(fp_Out);
  
      return 0;
  }
  </code></pre>
  
  <p>When I run it after the second input it said Segmentation fault (core dumped).</p>
  
  <p>More anyone please help me with this?
  I am new on this and I am like to learn.</p>