I want to read data from a txt-file that looks like this:
aaa 4 12.45
bbb 3 7.34
ccc 12 3.45
and store the data in an array of structures. The struct and array are defined like this
Expand|Select|Wrap|Line Numbers
- struct proPkaData {
- char Name[4];
- int Index;
- float Pka;
- } Data;
- vector<proPkaData> DataArray;
int i=0;
while (!infile.eof()){
infile>>DataArray[i].Name;
i++
The program compiles and run but immediately gives an error: "Access Violation at address 00401789". I can't figure out the reason for that?
Thanks for the help!