[try Beta version]
Not logged in

 
cant close a file

Dec 2, 2014 at 9:50pm
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;
}
Dec 2, 2014 at 10:04pm
Call the close() function on the ofstream instead of the string.
Dec 2, 2014 at 10:33pm
o wow i feel dumb thanks
Topic archived. No new replies allowed.