Saving to a file?

Hi so I'm trying to figure out how to save the input of the code to a file. How would I go about doing this? Thanks in Advance.


#include <string>
#include <iostream>
using namespace std;


int main()
{
string SomethingHere;

cout << "Write something here: ";
getline(cin, SomethingHere);
cout << SomethingHere << endl;


system("pause");
return 0;
}
There's actually a section in the tutorial on this site dedicated to I/O stuff. See here: http://cplusplus.com/doc/tutorial/files/

Have fun!

-Albatross
Topic archived. No new replies allowed.