I have a file.txt that contains:
Marco Beno
Polo
15
Mario
Pollo Pollo
20
and struct defined as that:
struct person{
char name[15];
char surname[15];
int age;
}
now I want to read into this struct this file line by line, so marco beno is assigned to person.name,Polo to person.surname and so on... I have been looking for a solutions but couldn't find related example. The problem is that space is skipping the reading to next variable so Marco is name and Beno is surname. However it should look like that: person.name == Marco Beno