fix array of char array
This commit is contained in:
parent
c06d9ea962
commit
1d7cad30c7
23
config.c
23
config.c
@ -9,24 +9,33 @@ int loadConfig(char *file, char **str_entry,int size)
|
||||
int i=0;
|
||||
bool terminate=false;
|
||||
FILE *f_config;
|
||||
char temp_str[64];
|
||||
|
||||
printf("opening config file\n");
|
||||
|
||||
for(i=0;str_entry[i];i++)
|
||||
{
|
||||
printf("\nentry: %s",str_entry[i]);
|
||||
}
|
||||
|
||||
printf("\nopening config file\n");
|
||||
f_config = fopen("config","r");
|
||||
if(f_config != NULL)
|
||||
{
|
||||
for(i=0;i<size & terminate==false;i++)
|
||||
for(i=0;i<size;i++)
|
||||
{
|
||||
printf("for loop:%d",i);
|
||||
if(fgets(str_entry[i],10,f_config)!=NULL)
|
||||
printf("for loop:%d\n",i);
|
||||
printf("str:%s\n",str_entry[i]);
|
||||
if(fgets(temp_str,64,f_config)!=NULL)
|
||||
{
|
||||
puts(str_entry[i]);
|
||||
printf("fgets:%s",temp_str);
|
||||
str_entry[i]=strdup(temp_str);
|
||||
printf("str_entry:%s",str_entry[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
terminate = true;
|
||||
break;
|
||||
fclose(f_config);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user