reading and writing to file
I have written a piece of code that is supposed to identify and record
all the text in between tags
(ie. <title> help please </title>
code would only record
<title> and </title>
I compiled and the compiler did not catch any errors.
I can open the file and create the output file, but then the console just hangs up
I am sure it is how I have my if loop worded, any help would be appreciated even if it is a look at this line!
this is the code that i am working with
Code:
inFile.get( ch ); // this reads one character
// notice this does not skip whitespace
while( !inFile.eof() )
{
if (ch == '<')
{
//outFile << ch; // write this character to the output file
//cout << ch; // write this character to the monitor
outFile.put( ch );
cout.put( ch );
inFile.get( ch ); // read the next character from the file
outFile.put( '>' );
cout.put( '>' );
}
}
thanks