fscanf array of string code example
Example: fscanf array of string
//This will reserve 100 character arrays, or 100 strings
char *arr[100];
int count = 0;
while (fscanf(fp, "%999s", str) == 1)
{
arr[count] = malloc(strlen(str) + 1);
strcpy(arr[count], str);
count++;
if (count == 100)
break;
}
int i;
for (i = 0; i < count; i++)
printf("%s\n", arr[i]);