Hi,

I have two .txt files.

I am trying to combine each line from the first file with each line from the second file, using a nested loop:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;

int main ()
{
    string keyword = "";
    vector<string>vectorOfStrings;
    ifstream ifs( "anchortxt.txt" );
    string temp;

    while( getline( ifs, temp ) )

    {
        vectorOfStrings.push_back( temp );
    }

    vector<string>vectorOfStringsTwo;
    ifstream ifss( "rhwdtieronearticles.txt" );
    string temps;

    while( getline( ifss, temps ) )
    {
        vectorOfStringsTwo.push_back( temps );
    }

    for (unsigned int i=0; i<=vectorOfStrings.size(); i++)
    {


        for (unsigned int j=1; j<=i; j++)
        {
            string aa = vectorOfStrings[i] + vectorOfStringsTwo[j];
            cout << aa << endl;
            aa.clear();
        }
    }

    return 0;
}
I am using Code::Blocks on Ubuntu 64bit.

When I try to build and run the program I get the following:

Segmentation fault
The two text files contain strings/lines which are around 500 characters in length and contain many different characters such as % | ' , .

When I run the program on txt files that contain just around 30 chars per line, with just a-z characters in, it runs fine.

Can anyone suggest why this is occurring?

Many thanks