Thread: Executýng Commands In a Program

  1. #1
    esler
    Guest

    Question Executýng Commands In a Program

    hi
    ý want to execute some DOS commands wýthýn my program.
    ýs ýt possýble

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    Cool

    Read dos.h in the help or index... Maybe it might help u.

    blueXrogue

  3. #3
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    Posts
    212
    Yes it is possible. In the ANSI/ISO C standard there is a header file called <stdlib.h> include it then use a function called system();
    Heres an example.

    #include <stdio.h>
    #include <stdlib.h>

    int main(int argc, char *argv[]){
    system("cls"); // Clears the Screen
    system("copy file1 file2"); // Copy file
    system("del file1"); delete original file
    return 1;
    }

    all OS system commands can be use. BE WARNED they are not likely to be portable programs because the are OS dependent.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. Executing OS Commands via my C# Program
    By gozlan in forum C# Programming
    Replies: 2
    Last Post: 07-05-2003, 01:30 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM