hey in my book it talks about end of file in c++ i think its where u would make ctrl+q for example end the program and stuff like that and i have no idea how it works so if anyone cna help me id appreciate it thanx
hey in my book it talks about end of file in c++ i think its where u would make ctrl+q for example end the program and stuff like that and i have no idea how it works so if anyone cna help me id appreciate it thanx
the end of file is a flag that literally marks the end of a file. YOu could use it while reading a file
so
while(!=EOF)
read file
you dont have to define it as when the data in a file ends there is an eof flag - i think its marked by a -1 value but im not 100% sure on that
Monday - what a way to spend a seventh of your life
well how would EOF work in this code?
#include <iostream.h>
int main()
{
char ch;
int count = 0;
cin.get(ch);
while (cin.fail() == false)
{
cout<<ch;
count++;
cin.get(ch);
}
cout<<"\n"<<count<<"characters read\n";
return 0;
}
how does taht get the output of
u type in anything u want
it repeats itself once
keeps this apttern up till u hit ctrl+z
how does that work
hooch
there are no references to eof in that code, it uses cin.fail() - im not quite sure what this does - its something do with the data stream being checked for 'bad' values - i dont know if EOF is included in that.
Monday - what a way to spend a seventh of your life
well eof is end of file right? and the book is talking about it the book is called c++ primer plus if uve heard of it or have it . its on page 191-193 sumthin like that
hooch