I'm trying to write a program that converts a txt file to HTML. Here is part of my code:
while (getline(text, lineInFile)) {
input.clear();
//input << lineInFile;
input.str(lineInFile);
input >> convert;
if(convert == "1"){
if (ul == true) {
html << "</ul>\n";
ul = false;
}
else if(ol == true){
html << "</ol>\n";
ol = false;
}
elseOr = true;
lineInFile.erase(lineInFile.begin() + 0, lineInFile.begin() + 1);
html << "<h1>" << lineInFile << " </h1>\n";
}
What I wanted in my HTML file was something like:
<h1> Hello </h1>
But instead what I'm getting is:
<h1> Hello
</h1>
I don't want the newline at the end there. How can I get rid of it?