i have a cpp code
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
string s,s1;
ofstream f("new.txt");
cin>>s;
f<<s;
f.close();
ifstream f1("new.txt");
while(!f1.eof())
{
f1>>s1;
cout<<s1;
}
return 0;
}
if i give the input string as "MAGICAL STRING WITH SPACES" . The ofstream object only writes "MAGICAL" into the textfile, what do i do to write and read whitespaces from string variables into an output file stream ?