cant close a file

for some reason it wont let me close my file dues anyone know why?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <string>
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
                string quishton;
 		ofstream output(quishton + ".txt");
		output << "text";
		quishton.close();
	
	system("pause");
	return 0;
}
Call the close() function on the ofstream instead of the string.
o wow i feel dumb thanks
Topic archived. No new replies allowed.