C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 5th, 2005, 12:49 PM
pssheba pssheba is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 2 pssheba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 29 sec
Reputation Power: 0
assigning values to variables usin cin in c++

is not working for me in case i press ctrl_z.
Having filled a text data file inside a do while, i press ctrl_z to end the process.
Than i try to assign value to a variable using cin but i cant because of the ctrl_z i had pressed before.
Is there a way to clean the data extraction from the "end of file" ?

Reply With Quote
  #2  
Old April 5th, 2005, 01:02 PM
Cirus Cirus is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 276 Cirus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 48 m 58 sec
Reputation Power: 4
Can you paste the code?
Question is not clear. Why do you want to press Ctrl-Z.This combination will break a runing process.

Reply With Quote
  #3  
Old April 5th, 2005, 03:22 PM
Parkin_m Parkin_m is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 10 Parkin_m User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 58 sec
Reputation Power: 0
you shouldnt be using Ctrl-Z to end the Do while. you should have something going up (such as x++) which should cause it to end.

i think thats what your going on about...

Reply With Quote
  #4  
Old April 6th, 2005, 05:19 AM
pssheba pssheba is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 2 pssheba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 29 sec
Reputation Power: 0
Yes i'm afraid i expressed my problem

very unclearly.
The reason i used ctrl_z is i was inserting data into a text file from within a do while loop.
There is no other way to stop it but using the ctrl_z key combination.
What i needed to do than was cin.clear() to enable the cin to continue working for me.
I'm sorry for displaying my problem in an unordered way.
And thanks a lot !

Reply With Quote
  #5  
Old April 7th, 2005, 03:15 AM
Cirus Cirus is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 276 Cirus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 48 m 58 sec
Reputation Power: 4
pssheba: I got what you are trying to say. I am paraphrasing in my on words. Correct me if I'm wrong:

You are using a Do-while loop to ask a user for imputs. Then at arbitrary time, you wish your program to stop taking input from the end user. For this you are taking help of Crtl-Z combination. Is this true?

In such case , you can ask question from user,whether he is interested in supplying inputs or not?
In case of yes, person cin operation, else , use " exit(1); " statement to shut down the program or "break;" for coming out of the loop but continue with execution process.

Probably, the input taken by "cin" statement is being redirected to a file. That is,
cin>>variable;
cout>> variable >> file;

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > assigning values to variables usin cin in c++


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT