cin >> buf endless loop

This is a discussion on cin >> buf endless loop within the C++ Programming forums, part of the General Programming Boards category; Hi I have the code Code: #include<iostream> using namespace std; int main() { string buf; while( cin >> buf ) ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    20

    cin >> buf endless loop

    Hi

    I have the code

    Code:
    #include<iostream>
    using namespace std;
    
    int main()
    {
    	string buf;
    
    	while( cin >> buf )
    	{
    		cout << buf;
    
    		//do some process in buf
    	}
    	//end the loop someway
    
    	cout << "The result";
    
    	return 0;
    }

    With what keyboard shortcut I can end the loop in order to proceed in my program ( I am not interested in signal solution or

    Code:
     
    if ( buf == "END" )
    break;
    Thanks

  2. #2
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    guess you mean control-D ( unix ) or control-Z ( Windows )
    Kurt

  3. #3
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    then you are interested in doing a windows application, not a console application. If you don't want to do signal processing or checking user input, then you need to do a windows application and use a message loop to check for keyboard shortcuts.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with this endless loop
    By xkohtax in forum C Programming
    Replies: 4
    Last Post: 05-01-2009, 03:32 PM
  2. Email attachment via smtp - how?!
    By lucky760 in forum C++ Programming
    Replies: 2
    Last Post: 07-04-2002, 08:59 PM
  3. for loop or while loop
    By slamit93 in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2002, 05:13 AM
  4. help with endless loop
    By haus in forum C Programming
    Replies: 4
    Last Post: 04-10-2002, 09:31 AM
  5. Endless shampoo loop
    By Garfield in forum A Brief History of Cprogramming.com
    Replies: 39
    Last Post: 11-07-2001, 10:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21