hi, have a little problem using fstream. first here is the code...
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
string word;
ofstream outl("biscuit.txt", ios::out);
cin>>word;
outl<<word;
system("pause");
return 0;
}
using this, i can type a word into the input screen and it saves whatever word i typed into the biscuit.txt file. now my problem is... how do i make it save a whole sentence (as many words as i wish... i think it has to do with the string
). secondly, how do i write a program that can read from the file and print it on the screen? and also how do i add data into the file without overwriting the previous data...( the book i'm using isnt too clear on that)
thanks
p.s.
is using ifstream
and ofstream
the same as using fin
and fout
? cuz i cant find enough info about fin
or fout
anywhere