Help with writing HTML to a file with C++?

Makuto9

New member
I am making a C++ app that lets laptop users take flash games off the internet and add them to their offline game library. The application is designed to get the game's filename and the main name of the game. The application then writes a link (in HTML) onto a html file and the process is complete. My problem is that when I write a new link, the </body> and </html> tags become before the link. Does anybody have a solution to this problem, and am I asking in the right place?
Here is the source code (sorry, I didn't comment it):
#include<iostream>
#include<string>
#include<fstream>

using namespace std;



string writer(string filename2, string gamename){
//Function for writing HTML
char names='"';
string returner="Done! Try it now.";
ofstream SaveFile("main.html",ios::app);
//Save HTML code for Game: <a href="gamename.swf" TARGET="game">Gamename</a><br />
SaveFile << "<a href=";
SaveFile << names;
SaveFile << filename2;
SaveFile << names;
SaveFile << " TARGET=";
SaveFile << names;
SaveFile << "game";
SaveFile << names;
SaveFile << ">";
SaveFile << gamename;
SaveFile << "</a><br />" << " ";
SaveFile << endl;
SaveFile.close();
return returner;
}
Due to the limit of 1000 characters, I can't put in the 'main.' Basically, it gets the filename of the game and the name of the game for the link.
 
Back
Top