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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

End of file character, Is it Ctrl-z in WinXP console?

Status
Not open for further replies.

AMcASummit

Programmer
Aug 29, 2002
1
US
Hi: I am having difficulty reading a list of integers entered in the console into a program I am writing. The code I am using is as follows?

int hmwk;
.
.
.

while (cin>>hmwk) {
hmwkVec.push_back(hmwk);
}

As you will see, I wish to populate a vector with the integers that are input at the command line.

I am not sure what the eof character in a windows xp console is. I have read that it might by Ctrl-z. I sometimes have luck with this, but in the current program, I have to hit Ctrl-Z and return 2 or more times before the program reacts as it should to an eof. I get the impression that the program is then processing the other keystrokes I have input and (because of the program's logic) it is then terminating.
 
Why not try something like
Code:
while (not(eof)) . . .
?
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that they think I am now
qualified to do anything with nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top