C++ and DOS interaction

This is a discussion on C++ and DOS interaction within the C++ Programming forums, part of the General Programming Boards category; It is possible to execute DOS commands with variables from C++ ?and if it is..how? Ej: net send variable1.server.com variable2 ...

  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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    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,136
    Bubba=ASM Lover

Popular pages Recent additions subscribe to a feed

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