If all sentences have the same pattern you can read the text line by line and split the line in words. You can do this with the below code :
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE * database;
char buffer[100];
database = fopen("test.txt", "r");
if (NULL == database)
{
perror("opening database");
return (-1);
}
while (EOF != fscanf(database, "%[^\n]\n", buffer))
{
printf("> %s\n", buffer);
char * token = strtok(buffer, " ");
while (token != NULL)
{
//First token is the name , third token is the age etc..
printf( " %s\n", token );//printing each word, you can assign it to a variable
token = strtok(NULL, " ");
}
}
fclose(database);
return (0);
}
For fscanf() i use the following post and you can also check it:
Traverse FILE line by line using fscanf
When you take each word from the sentence you can assign it to a variable or handle it as you wish