When I open .html file i got a few weird characters printed out which preceding the content inside the .html file. But when I have the same file content with .txt extension, it has not problem. Anyone knows why ? Thanks.
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string buff, temp;
ifstream file;
file.open("htmlfile.html");
if(file.is_open())
cout << "opened";
while(getline(file,temp))
buff += temp;
cout << buff;
return 0;
}
Comment