void BinaryTree::InitializeFromFile(string Filename){
ifstream inFile;
treenode* Freq[256];
inFile.open(Filename.c_str(), fstream::binary);
if(inFile.fail()){
cout<<"Error in opening file "<<Filename;
return;
}
for(int i=0;i<=255;i++){
Freq[i]->weight=0;
Freq[i]->data = '0'+i;
Freq[i]->LChild = NULL; Freq[i]->RChild=NULL; Freq[i]->Parent=NULL;
}
char c;
inFile.get(c);
while(!inFile.eof()){
Freq[c]->weight ++;
inFile.get(c);
}
}
I'm getting the Access Violation Exception in the for loop. Even when I comment out certain lines it'll give me an error on the next line in that loop.
Edit: Also is the line Freq[c]->weight ++;
valid? Can I go to a specific part of the array based on the char value?