Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

testing for EOF

Status
Not open for further replies.

worldwise

Programmer
Joined
Jun 1, 2005
Messages
112
Location
US
Hi,

I have a simple console application that continuously loops until the user enters an EOF (ctrl-z).

I have finished everything except testing for the EOF. How do I do this?

-kevin
 
I have no idea. Thats how the teacher created the assignment (this is for a continuing education class, not a college course).

I have completed the assigment to exit the loop when the user enters nothing but the teacher said "to exit on EOF (ctrl-z on intel machines)."

I thought there might just be a special key word that I could test against?
 
earthandfire,

Thanks.

Would this be correct then?:

//=======================================================
string response; //response from user

while (asc(response) != 26)
{
//blah blah
}
 
I don't use C# but if your code translates to:

while (asc(response) does not equal 26 then I would say yes.


Hope this helps.
 
Must admit I've always thought ctrl-d was eof (on *nix terminals, at least)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top