Dos programming Concept problem.

This is a discussion on Dos programming Concept problem. within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I was usually programming in windows before. now i recognized a difference between win and dos programming: in win, like ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    88

    Smile Dos programming Concept problem.

    I was usually programming in windows before.

    now i recognized a difference between win and dos programming:

    in win, like VB , FLASH, etc. it can run muti - program at a time,
    like playing the music, playing movie , and calculation at the same time.

    dos program , usually it has only one "main loop" ,
    the program is running the "loop" continuously .

    what is the way to run muti - program?

  2. #2
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    you obviously don't understand windows programming very well either. Windows programming has one main loop controlling everything just as a DOS app does. The main difference is that a windows program works with windows to accomplish tasks, a dos app does everything on it's own.

    there is no way to multi-task in dos if that's what you're asking.
    PHP and XML
    Let's talk about SAX

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    Originally posted by Waldo2k2
    you obviously don't understand windows programming very well either. Windows programming has one main loop controlling everything just as a DOS app does. The main difference is that a windows program works with windows to accomplish tasks, a dos app does everything on it's own.

    there is no way to multi-task in dos if that's what you're asking.
    >>>you obviously don't understand windows programming very well .

    yes, since i only write VB and FLASH before.


    Like VB or VC++ , it has "timer",
    we can run many timers at the same time.
    i know that every program is a MAIN LOOP looping.

    is it means that i must write progman like this :

    // a muti - timer's progman
    void main(){
    if ( time to invoke the timer function ) ......;
    if ( time to invoke the timer function ) ......;
    if ( time to invoke the timer function ) ......;
    ..
    ..
    ..
    }

    is it like this ?


    and if the "PLAYMUSIC()" function in a game is running,
    but how can control the sprite ??

    that means that i must write :

    int i
    void main(){
    playmusic( the i'th note );
    control (....);
    ....
    ....
    i++;
    }

    like this form????

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    what you're asking about has nothing to do with windows or dos programming, it's simply a matter of it being in c/c++.
    You can write a program with several if statements or anything else you want, just as in windows. Here's an example program in DOS.
    Code:
    #include <iostream>
    using namespace std;
    //NEVER USE VOID MAIN, EVER!!
    int main()
    {
         for (int i=0;i<=5;i++)
         {
            std::cout<<"hello"<<std::endl;
          }
    return 0;
    }
    PHP and XML
    Let's talk about SAX

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Things aren't running at the same time in Windows either. Put a while(true){} somewhere in your code and you'll see that your program halts.

    There is a concept know as multithreading, but it doesn't make things run simultaneously. It's just an illusion. Windows runs a piece of code of one program, then another, then a little code for WinAmp, then a little code for your program again, then more for Explorer etc...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    Originally posted by Waldo2k2
    what you're asking about has nothing to do with windows or dos programming, it's simply a matter of it being in c/c++.
    You can write a program with several if statements or anything else you want, just as in windows. Here's an example program in DOS.
    Code:
    #include <iostream>
    using namespace std;
    //NEVER USE VOID MAIN, EVER!!
    int main()
    {
         for (int i=0;i<=5;i++)
         {
            std::cout<<"hello"<<std::endl;
          }
    return 0;
    }
    this is only a process.
    no program will run once like this.

    it must in looping to check the mouse, key ....

  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    Originally posted by L.O.K.
    this is only a process.
    no program will run once like this.

    it must in looping to check the mouse, key ....
    damn are you stupid.
    first you ask a question, then you smart off to those who (know more than you) and help you.
    That program will run just fine, i don't have to check for the mouse or keys. Besides all i'd have to do is do cin>> whenever i want input from the keys.
    What you said is like saying hello world doesn't work, does that check for keys?? NO.
    >>no program will run once like this.
    Jesus man, why don't you try compiliing it?
    PHP and XML
    Let's talk about SAX

  8. #8
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    Originally posted by Waldo2k2
    damn are you stupid.
    first you ask a question, then you smart off to those who (know more than you) and help you.
    That program will run just fine, i don't have to check for the mouse or keys. Besides all i'd have to do is do cin>> whenever i want input from the keys.
    What you said is like saying hello world doesn't work, does that check for keys?? NO.
    >>no program will run once like this.
    Jesus man, why don't you try compiliing it?
    OK.

  9. #9
    Registered User
    Join Date
    Nov 2002
    Posts
    32
    dude its quite simple they dont run at the same time they switch turns so quickly it seems theyre doing their **** at the same time. ie if you had 2 timers...

    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1

    until it reaches wutever number
    Silent to All
    -Those who live by the sword get shot by those who don't.

  10. #10
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    Originally posted by TheUnheardHuman
    dude its quite simple they dont run at the same time they switch turns so quickly it seems theyre doing their **** at the same time. ie if you had 2 timers...

    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1
    timer 1 will increment 1
    timer 2 will increment 1

    until it reaches wutever number
    O., SEE.
    thx.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM

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