Hello, I have this piece of code here, which opens a text file and puts text in it.
1 2 3
|
std::ofstream myfile;
myfile.open(filename);
myfile << text << endl;
|
I was wondering if there is a >> operator to get lines from the text file.
For example:
1 2 3
|
std::ofstream myfile;
myfile.open(filename);
myfile >> text >> endl;
|
Last edited on
Thanks Fransje.
Just a few other questions, how do you know when you are at the end of the file?
For example:
1 2 3 4 5 6
|
while(!FALSE)
{
myfile >> text;
if (text==NULL)
{break;}
}
|
Also, would I define
text
as
string
? Does
>>
take the full line or the full file or a
char
?
Thanks!
Last edited on