infinite while loop Q

This is a discussion on infinite while loop Q within the C Programming forums, part of the General Programming Boards category; Hi I have Q I am working on OS project and I need to create infinite loop like Code: While(1){ ...

  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,220
    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 nawaf227@yahoo.com
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-15-2009, 12:24 AM
  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, 01:09 PM
  4. Switch statement = infinite loop
    By Lucid003 in forum C++ Programming
    Replies: 10
    Last Post: 10-10-2005, 01: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, 12:17 PM

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