Programming help

I wrote the following code: (well I wrote the markup function within it, the rest was written by my teacher)

Code (Text):

// markup.cpp
//
// You must complete this program by properly implementing
// the routine called markup. You can implement other routines
// to help markup do its work.
// ==================================================================
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <vector>
using namespace std;

// ==================================================================
// The characters used to mark the opening and closing of tags,
// the name of the body tag and the body closing tag (in lower case),
// and the markup strings used. Note that all of these are marked as
// constant so they cannot be changed by the executing algorithm.
// You do not need to use this, but are encouraged to use them, or
// something like them.
// ==================================================================
const char opentag ='<';
const char closetag ='>';
const string bodytag("body");
const string bodyclosetag("/body");
const string startMarkup("<B style=\"color:black;background-color:#A0FFFF\">");
const string endMarkup("</B>");

// ==================================================================
// You should declare other routines that you use in implementing
// your markup routine
// ==================================================================

// ==================================================================
// ==================================================================
// ===>> main <<=====================================================
// main takes arguments from the command line, which represent
// the name of the code, the name of the inputfile, and a list of
// words to search for. argc is the number of argumens provided, and
// argv is an array of c-strings that store the command line arguments
//
// Main is complete. You do not need to change anything in main.
int main(int argc, char * argv[])
{
// Make sure there are at least 3 words on the command line
if(argc < 3) printUsage(argv);

// ===>> markup <<===================================================
// Read data from the in stream, find all of the words from the list
// of searchTerms, mark them bold on a cyan background, and write the
// marked up data to the outstream. On entry the input stream will
// be ready for use and on the first character, the output stream
// will also be ready for use. searchTerms will be a vector of words
// to search for; it will contain at least one word, and all the search
// words will be in lowercase.
// ==================================================================
void markup(istream & in, ostream & out, const vector<string> & searchTerms)
{

string eCode= "</B>";
vector<string> bodyTemp;
int gate=0, posStart,posMiddle, posEnd;
// This routine does not do anything useful yet.
// You will make it useful. At present it just
// copies the input stream to the output stream one
// character at a time

char c;
c = in.get(); // get one character from the input
while(not in.fail())
{
content.push_back(c);
//cout << c;
// input succeded, so write the charcter to output
c = in.get(); // get one character from the input
}

// ===>> parseInput <<===============================================
// Get the input file name, open the input and output files, and get
// the search words. argc is the number of command line arguments,
// and argv is an array of those arguments as c-strings. On exit in
// and out will be connected to files and ready for use, and
// searchTerms will be contain a list of strings containing words
// to search for, converted to lowercase letters.
//
// Requires that argc >= 3.
// ==================================================================
void parseInput(int argc, char * argv[],
ifstream & in, ofstream & out,
vector<string> & searchTerms)
{
// attach in to the input file
in.open(argv[1]);
if(in.fail())
{
cerr << "Input file " << argv[1] << " did not open\n";
exit(EXIT_FAILURE);
}

and It works for most things, but I was trying to figure out while on some cases such as the boring.txt (please rename extention to .htm or .html if you test it) the program aborts. the program reads in a file then you give a vector of search terms and it finds them