fix array of char array

This commit is contained in:
Jonathan Santis 2024-09-11 10:54:21 +02:00
parent c06d9ea962
commit 1d7cad30c7

View File

@ -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