#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
 string linea;
 ifstream fileIn("input.txt"); 
 ofstream fileOut("output.html",ios::out);

 //working with the input text
 if (!fileIn)

  cout<<"\nERROR: Unable to read the file!\n";

 else
 {
  //working with the output text
  if (fileOut.is_open())
  {
   fileOut << "<html xmlns=\"http://www.w3.org/1999/xhtml";
   fileOut << "\" xml:lang=\"en\">" << endl;
   fileOut << "<head>" << endl;
   fileOut << "<meta http-equiv=\"Content-Type\"content=";
   fileOut << "\"text/html; charset=UTF-8\" />" << endl;
   fileOut << "<title>" <<"The Republic, by Plato" <<"</title>" << endl;
   fileOut << "</head>" << endl;
   fileOut << "<body>" << endl;

   while (! fileIn.eof() )//lectura de lineas del archivo
   {
    getline (fileIn, linea);
    fileOut << linea <<"<br />" <<endl;

   }//end while

   fileOut << "</body>";
   fileOut << "</html>";
   
   fileIn.close();
   fileOut.close();

  }//end if

 }//end else
}

I would like to get so that the source code instead of looking like <br /> at the end of every line. so that it will only put an </br> at the end with out a space

Can't you just use fileOut << linea <<"</br>" <<endl; in line 34?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.