Hi MegaBrains,
Working in Dev-C++ I defined the following structure
#define NO_SECTIONS 6
struct Track{
int Number;
int noElems;
float x_pos;
float y_pos;
int type;
int state;
} ;
Track Trk[NO_SECTIONS];
I want to fill the Trk array with data from a data file like so:
int trk_no, divis, i;
float posx, posy;
i=0;
ifstream inifile ("init.txt") ;
if (inifile.is_ope n())
{
while (! inifile.eof() )
{
inifile >> trk_no,divis,po sx,posy ;
Trk.Number[i]=trk_no; <-----
Trk.noElems[i]=divis; <-----
Trk.x_pos[i]=posx; <-----
Trk.y_pos[i]=posy; <-----
i++;
}
inifile.close() ;
}
The following error typr is given for each of the lines marked above:
request for member `Number' in `Trk', which is of non-class type
`Track[6]'
So what did I do wrong?
Thanx!!
Working in Dev-C++ I defined the following structure
#define NO_SECTIONS 6
struct Track{
int Number;
int noElems;
float x_pos;
float y_pos;
int type;
int state;
} ;
Track Trk[NO_SECTIONS];
I want to fill the Trk array with data from a data file like so:
int trk_no, divis, i;
float posx, posy;
i=0;
ifstream inifile ("init.txt") ;
if (inifile.is_ope n())
{
while (! inifile.eof() )
{
inifile >> trk_no,divis,po sx,posy ;
Trk.Number[i]=trk_no; <-----
Trk.noElems[i]=divis; <-----
Trk.x_pos[i]=posx; <-----
Trk.y_pos[i]=posy; <-----
i++;
}
inifile.close() ;
}
The following error typr is given for each of the lines marked above:
request for member `Number' in `Trk', which is of non-class type
`Track[6]'
So what did I do wrong?
Thanx!!
Comment