Thread: infinite while loop Q

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    31

    infinite while loop Q

    Hi
    I have Q
    I am working on OS project and I need to create infinite loop like
    Code:
    While(1){
            .
            .
    process
            .
            .
    }
    My Q is how can I allow the user to pause/stop the loop (stop the process)
    via keyboard without either losing data or exiting the program?

    If the answer through using System function (system call) Please tell me how can I do it on windows OS

    I will be appreciate for ur help

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    nonstandard but should work with quite a few compilers:
    Code:
    #include <conio.h>
    
    int main(void)
    {
    	while (!kbhit()) {
    		...
    	}
    	return 0;
    }
    Last edited by Brian; 11-21-2003 at 04:56 AM.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    31
    thank u very much my friend

    and this file for u
    source code for " regular expression"
    present from me and if u want the discription for it please send a message to [email protected]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2009, 11:24 PM
  2. Cosine fucntion and infinite loop.
    By youareafever in forum C Programming
    Replies: 2
    Last Post: 11-07-2008, 04:45 AM
  3. Infinite Loop with GetAsyncKeyState
    By guitarist809 in forum Windows Programming
    Replies: 1
    Last Post: 04-18-2008, 12:09 PM
  4. Switch statement = infinite loop
    By Lucid003 in forum C++ Programming
    Replies: 10
    Last Post: 10-10-2005, 12:46 AM
  5. stays in loop, but it's not an infinite loop (C++)
    By Berticus in forum C++ Programming
    Replies: 8
    Last Post: 07-19-2005, 11:17 AM