Thread: C++ and DOS interaction

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    1

    Exclamation C++ and DOS interaction

    It is possible to execute DOS commands with variables from C++ ?and if it is..how? Ej: net send variable1.server.com variable2
    thanks!!!

  2. #2
    Unregistered
    Guest
    system("command");

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    system("command");

  4. #4
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Code:
    #include <stdlib.h>   // For system()
    
    int main()
    {
       system("date");
       return 0;
    }
    You can use cstdlib as well, but be sure to code the rest of your code in ANSI C++ then.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    you can also use process.h

  6. #6
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    I did not know that. Thanks

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    hey, i just recently made a program that uses the net send thing, if you want the code i can post it for you

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The correct way to access DOS commands is via int 21h. There are a host of functions that you can access on this interrupt.
    Check the DOS tech refs for information on correct register values and on how to interpret return values.

  9. #9
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Bubba=ASM Lover

Popular pages Recent additions subscribe to a feed