make a program stay....

This is a discussion on make a program stay.... within the C Programming forums, part of the General Programming Boards category; i was writing a program to demonstrate how ports are accessed using c. i am using the parmon (parallel port ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    4

    Angry make a program stay....

    i was writing a program to demonstrate how ports are accessed using c. i am using the parmon (parallel port monitor) to see the counting (see program). but every time i send the program window to the back (using wimdiws98...turbo c for compiling), the program halts and resumes only afer the window is activated again. how do i make te program keep running even if i send its program window to the back?

    here's the prog:

    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <dos.h>
    
    #define base 0x378
    
    void main()
    {
    unsigned char i=0;
    char ch;
    
    clrscr();
    printf("Press <ESC> to exit the program");
    
    fflush(stdin);
    
    do
    {
    outportb (base , i);
    i++;
    delay (1000);
    if (kbhit())
    	ch=getch();
    }while (ch!=27);
    
    printf("\nBYE!!!");
    getch();
    }

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    27
    Try this:

    Code:
    #include <stdlib.h>
    int main()
    {
    system(“PAUSE”);
    return 0;
    }

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    4
    doesnt work!!!

  4. #4
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    >fflush(stdin);
    Don't use this. Check the FAQ: http://faq.cprogramming.com/cgi-bin/...&id=1043284351

    As for your question regarding the window. If you were using say a dialog box there is probably a Windows API to make it active. Not sure for a DOS console window.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  5. #5
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    When putting a DOS box into the background on Win98, the process is paused. I don't know if there is a way around that, but it will have nothing to do with your program. It's an OS function.

    Maybe a property of the window will allow the program to continue. If not, try searching google. If it can be done, the great googly-moogly will know.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    4
    there has to be a way.....comeon!!!

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    Originally posted by Nirav
    there has to be a way.....comeon!!!
    There is:
    1) Upgrade to XP
    2) Use Linux
    3) Call Microsoft and have them fix Win98

    Sheesh!
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with this program I'm trying to make
    By Sshakey6791 in forum C++ Programming
    Replies: 14
    Last Post: 12-01-2008, 03:03 PM
  2. Replies: 9
    Last Post: 06-17-2008, 11:38 AM
  3. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 01:05 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. How To Make The Program Installed In Program Files Folder?
    By javacvb in forum Windows Programming
    Replies: 4
    Last Post: 11-05-2003, 04:33 PM

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