change fstream file location ?

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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "pch.h"
#include <iostream>
#include <fstream>
#include <string>

using namespace 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.
 
ofstream html("C:/users/documents/newfolder/" + html_name);

Topic archived. No new replies allowed.