gather information from a file PROBLEM

I am trying to read a html file to collect data from it. I am currently having a problem with my output (semantic error). I am supposed to read each individual character while counting them. I am also supposed to specify links and tags (and a few other things but I dont have all that code up yet). I am to assume the character (<) will start a tag and the combination of characters (<a) will start a tag and that the character (>) ends tags and links. I have my code the file im trying to read and the output all listed below. let me know what you think I should do.


~~~~~~~~HERES MY CODE~~~~~~~~
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
ifstream inFile;
const int SIZE = 65; // Array size for file
char file_name[SIZE];
char ch;
int countChar = 0;
int countLink = 0;
int countTag = 0;
const char OPEN = '<';
const char LOWER = 'a';
const char UPPER = 'A';
const char end = '!';
const char CLOSE = '>';
const char DASH = '-';
char prevChar;
char currChar;


cout << "\t ---------------------------------------------\n\t "
"============ HTML File Analyzer =============\n\t "
"---------------------------------------------" <<endl;

// get the file name
cout << " Please enter a valid filename (no blanks!): " << endl;
cin >> file_name;

//open the file if it exists
inFile.open(file_name, ios::in);
if (!inFile)
{
cout << " The file you have requested does not"
" exist please try agin "<< endl;
return 0;
}
//Get each character from the file and dispay them.
inFile.get(prevChar);
inFile.get(currChar);
countTag = 2;
while (!inFile.eof())
{



while (prevChar == OPEN)
{
while (currChar != CLOSE)
{
if (currChar == LOWER)
{
countLink++;
prevChar = currChar;
}
inFile.get(currChar);
countChar++;
}
if (currChar == CLOSE)
{
countTag++;
prevChar = currChar;
}
inFile.get(currChar);
countChar++;


}
inFile.get(prevChar);
countChar++;
}
// close the file
inFile.close();
cout << "\n\n your countChar is " << countChar << endl;
cout << " \n\n tag count is " << countTag<< endl;
cout << " \n\n link count is " << countLink << endl;

return 0;
}

~~~~~~~~~HERES THE FILE SOURCE~~~~~~~~~

<!--
AUTHOR: A.F. Tyson
VERSION: 1.0.0
PURPOSE: Sample HTML File used to test programming assignment
NOTE: if you want to view this file as HTML, download the
image files it references as well
-->

<HTML>
<HEAD>
<TITLE>COP 3014: Introduction to C++ Programming</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B"
ALINK="#0000EE">

<IMG SRC="titlegraphic.gif" HSPACE=1 VSPACE=1 BORDER=0 HEIGHT=150 WIDTH=600>

<center>
<H1>Welcome to COP 3014 at the Florida State University</H1>
<H2>Spring Term 2010</h2>

</center>
<UL>
<H2>
<IMG SRC="redball.gif" >
<A HREF="intro.html">Introduction and General Information</A>

<P><IMG SRC="redball.gif" >
<A HREF="facultyTAs.html">Teaching Staff</A>

<P><IMG SRC="redball.gif" >
<A HREF="lectureRecitation.html">Lecture and Recitation Section Schedule</A>

<P><IMG SRC="redball.gif" >
<A HREF="announce.html">Announcements</A>

<P><IMG SRC="redball.gif" >
<A HREF="syllandLecs.html">Syllabus and Lecture Notes</A>

<P><IMG SRC="redball.gif" >
<A HREF="handouts.html">Handouts</A>

<P><IMG SRC="redball.gif" >
<A HREF="outsideSoftDoc.html">Useful Software and Documentation</A>

<P><IMG SRC="redball.gif" >
<A HREF="assignments.html">Assignments</A>

<P><IMG SRC="redball.gif">

<A HREF="grades.html">Current Semester Grades</A>

<P><IMG SRC="redball.gif" >
<A HREF="honor.htm">The FSU Academic Honor Policy</A>

</H2>
<hr>
<CENTER>
<I>Last updated: January 25, 2010&nbsp;</I>
<H3>
<IMG SRC="mailbox.gif" ALIGN=CENTER>
<B><I> Questions/Comments ?
<FONT SIZE=+1><A HREF="mailto:aftyson@cs.fsu.edu">

aftyson@cs.fsu.edu</A></FONT></I></B></H3>
</center>
<hr>

</BODY>
</HTML>


~~~~~~~~~~~~~HERES THE OUTPUT~~~~~~~~~~~~



your countChar is 1658


tag count is 64


link count is 18


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ANY IDEAS?
key word being IDEAS!
what exactly is the issue?
Topic archived. No new replies allowed.