| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Still floundering in C Set ++ |
-=> Quoting Bill Patterson to All <=-
Hi Bill,
BP> I've tried every flag, call, setting or function I can to get this to
BP> work right, but it won't. If anyone can make this compile and work
BP> under C Set ++, it'd be mucho appreciaited.
BP> #include
BP> main()
BP> {
BP> char input;
BP> cout << "\n\n Hit return to continue:";
BP> cout.flush();
BP> cin >> input;
BP> }
This code compiles without warning here (CSet 2.01). I gather the
problem you are having is that the function won't terminate until it
receives a couple of "Enter"s. Try using cin.get(input) instead of
cin >> input and I think you'll find it will do what you want.
The problem is that the ios flags for cin default to ios::skipws|...|.
When you enter your carriage return cin skips leading white space and
continues reading the input stream, waiting for a valid char.
The alternative way around this is to:
cin.unsetf(ios::skipws);
cin >> input;
which will work, but you'll need to reset the ios flags afterwards,
if the rest of your program requires ios::skipws to be set.
Regards,
Peter Rye
--- Blue Wave/Max v2.20
* Origin: [+61 9 454 6970] -= Tiara Information Services =- (3:690/354)SEEN-BY: 620/243 632/348 640/820 690/245 254 354 370 380 388 500 501 613 660 SEEN-BY: 690/686 711/409 410 413 430 807 808 809 934 949 955 712/515 713/888 SEEN-BY: 800/1 7877/2809 @PATH: 690/354 613 660 711/409 808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.