Click to See Complete Forum and Search --> : Using Delimiter EOF :: C++


kuphryn
March 3rd, 2002, 12:30 AM
Hi.

I am working on a small practice program for a C++ class. I need to implement a way to delimite using EOF. The user can break out of a while, for example, with ctrl-d (dos) or ctrl-z (unix).

What is the best way to implement something like that?

I have tried this:

while((num = cin.get()) != EOF) // from Deitel
{}

The above does not work.

Thanks,
Kuphryn

NMTop40
March 3rd, 2002, 04:40 AM
breaking out in UNIX with Ctrl-Z is a feature of the operating system, not of the program.




The best things come to those who rate