Hello ! I am trying to write a program that creates HTML files and fills them out for you. I am using a windows computer with the windows 10 operating. The IDE I'm using is visual studio.
this is my code so far:
#include "pch.h"
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main()
{
string web_name;
string html_name;
cout << "what do you want the name of your website to be ?";
cin >> web_name;
html_name = web_name;
html_name.append(".html");
ofstream html(html_name);
html << "<!DOCTYPE html>" << endl << "<html> " << endl << "<head>" << endl
<< "<title></title>" << endl << "</head>" << endl << "<body>" << endl
<< "</body>" << endl << "</html>";
html.close();
}
I am satisfied with the results so far but I've realized that this saves files into the application folder. Is it possible to change where the file is saved ? maybe in a location like C:\users\documents\newfolder. I've tried to look for the answers online but couldn't find a direct solution.