How to end input - Ctrl Z doesn't seem to work

A

Angus

Hello

I am using getline (and an example from Accelerated C++) but when I try to
end the input I use Ctrl Z but in the console window just see ^Z - and input
does NOT end - just carries on requesting input. I am on Windows platform.

What am I doing wrong?

Puzzled Person
 
A

Alf P. Steinbach

* Angus:
I am using getline (and an example from Accelerated C++) but when I try to
end the input I use Ctrl Z but in the console window just see ^Z - and input
does NOT end - just carries on requesting input. I am on Windows platform.

What am I doing wrong?

From a C++ perspective the most likely problem is your testing of end
of file.

Post the code.

From a Windows user perspective, it may be that you're not typing Ctrl
Z on a line of its own, but how to use various command interpreters etc.
is off-topic in this group -- see the FAQ for group suggestions.
 
A

Andrew Koenig

From a C++ perspective the most likely problem is your testing of end of
file.

One other possibility: Some C++ implementations have bugs that require you
to type ^Z twice.

You're probably better off putting the input data into a file and then
running your program with its standard input redirected to read from the
file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top