I have the following
while(!feof(f)){
(*ptr).push_back(carro());
fscanf (f, "%d", (*ptr)[add].id);
fscanf (f, "%s", (*ptr)[add].marca);
add++;
}
Where * ptr is & vector, a vector of a struct car, I have already gotten it with that record but for some reason I do not understand the program, when it loads from the file, it bursts.
The file, if it is important, contains:
1 VW
2 Seat
3 Audi
And the struct is as follows:
typedef struct Auto{
int id;
char marca[50];
}carro;
Thank you!