#include
#include
#include
using namespace std;
int main() {
string x;
getline(cin,x);
ofstream o(\"f:/demo
You get exactly what you write: the binary raw value of a pointer to char...
#include
#include
#include
using namespace std;
int main()
{
string x;
getline(cin,x);
ofstream o("tester.txt");
o << x;
o.close();
}
If you insist on writing a buffer directly, you can use
o.write(x.c_str(), x.size());
PS A little attention to code formatting unclouds the mind