Access reading error when using class member variable
- by bsg
Hi,
I have a class with private member variables declared in a header file. In my constructor, I pass in some filenames and create other objects using those names. This works fine. When I try to add another member variable, however, and initialize it in the constructor, I get an access reading violation. I sent the code to someone else and it works fine on his computer. Any idea what could be wrong?
Here is the offending code:
The .h file:
class QUERYMANAGER {
    INDEXCACHE *cache;
    URLTABLE *table;
    SNIPPET *snip;
    int* iquery[MAX_QUERY_LENGTH];
    int* metapointers[MAX_QUERY_LENGTH];
    int blockpointers[MAX_QUERY_LENGTH];
    int docpositions[MAX_QUERY_LENGTH];
    int numberdocs[MAX_QUERY_LENGTH];
    int frequencies[MAX_QUERY_LENGTH];
    int docarrays[MAX_QUERY_LENGTH][256];
    int qsize;
public:
    QUERYMANAGER();
    QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname);
    ~QUERYMANAGER();
This is the .cpp file:
#include "querymanagernew.h"
#include "snippet.h"
using namespace std;
QUERYMANAGER::QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname){
    cache = new INDEXCACHE(indexfname, btfname);
    table = new URLTABLE(urltablefname);
    snip = new SNIPPET(snippetfname, snippetbtfname);
    //this is where the error occurs
    qsize = 0;
}
I am totally at a loss as to what is causing this - any ideas?
Thanks, bsg