where the segmentation fault is generated in this code?
<pre><code>class Transaction  //TO store a transaction read from file
{
public:
    int maxlenth;
    int length1,length2;
    vector&lt;string&gt; *items;
    vector&lt;int&gt;  *share; 
    int tmv;

    Transaction():maxlenth(Translen),length1(0),length2(0)
    {
        items=new vector&lt;string&gt;(maxlenth);
        share=new vector&lt;int&gt;(maxlenth);
    }
    ~Transaction()    
    {
        delete items;
        delete share;
    }

    void set_tmv()
    {
        tmv=0;
        for(int i=0;i&lt;=length2;i++)
               tmv=tmv+(*share)[i];
    }     
};


class Data
{
public:
    ifstream in;

    Data(char *filename);
    ~Data();

    Transaction&amp; getnextTransaction(Transaction &amp;Trans);
};


Data::Data(char *filename)
{
    ifstream in(filename);
        assure(in,filename);
}

Data::~Data()
{
    in.close(); 
}

Transaction&amp;  Data::getnextTransaction(Transaction &amp;Trans)
{
    const char* delimiters =
          "  \t;()\"&lt;&gt;:{}[]+-=&amp;*#.,/\\~";

    //ifstream in("testdata.txt");
    //set&lt;string&gt;Items1;
    vector&lt;string&gt; v(5);
    int i=0;
    string line;
    getline(in, line); 

    char* s =strtok((char*)line.c_str(), delimiters);
    while(s) 
    {
        if(i==v.size())
            v.resize(v.size()*2);

        v[i++]=s;
        s = strtok(0, delimiters);
    }
    vector&lt;string&gt;::iterator it=v.begin();
    int j=0;
    while(j&lt;50)
    {
        (*Trans.items)[(Trans.length1)++]=v[j];
        j=j+2;
    }
    j=1;
    while(j&lt;=50)
    {
        (*Trans.share)[Trans.length2++]=(atoi(v[j].c_str()));
        j=j+2;
    }

    //copy(v.begin(),v.end(),ostream_iterator&lt;string&gt;(cout,"\n");
    return Trans;
}

int main()
{
    Data d("testdata.txt");
    Transaction t,q;

    d.getnextTransaction(t);
    t.set_tmv();

    return 0;
}
</code></pre>

<p>While I am debugging with gdb, I am geting something like:</p>

<blockquote>
  <p>Programm recieved SIGSEGV segmentation fault in std::string::assign(std::string const &amp;)</p>
</blockquote>

<p>While I am including the line <code>ifstream in("testdata.txt")</code> in function <code>getNexttransaction()</code>, I am not getting any error.</p>

<p>What's going wrong?</p>
