Example #1
0
void		read_case(t_app *app, char *line)
{
	static int		n = 0;
	unsigned int	rt;
	unsigned int	i;
	unsigned int	count;
	char			**array;

	i = 0;
	rt = 0;
	count = ft_strcount(line, ' ');
	if (read_other(app, line))
		;
	else if (count == 3)
	{
		array = ft_strsplit(line, ' ');
		rt = read_block(app, array, n);
		while (i < count)
			free(array[i++]);
		free(array);
		n += rt;
	}
	else
		app->read_mode = 3;
}
Example #2
0
File: file.c Project: kton/ecs30
void read_file(FILE *fp, Individual *individuals, Family *families)
{
  char line[256], *ptr;
  int individual_count = 0, family_count = 0;
  
  ptr = fgets(line, 256, fp);
  
  while(ptr != NULL)
  {
    if(strstr(line, "INDI"))
      ptr = read_indi(&individual_count, line, fp, individuals);
    else
      if(strstr(line, "FAM"))
        ptr = read_family(&family_count, line, fp,families);
      else
        ptr = read_other(line, fp);
    
  } // while more in the file
} // read_file()