Thread: Opening cmd from C source

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Opening cmd from C source

    Please help me!

    I have problem (not exactly problem), but I need help. I wrote a program that needs to be run from command prompt. It isn't problem for me to go to Start -> Run and type cmd. But is there any way to open console from source code. Thanks in advance.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    system()

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    If it's a console program, double-clicking it will open a command prompt while the program is running.

  4. #4
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    Smile

    Maybe this would help:

    Code:
    int main()
    {
       system("start cmd");
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Threads to keep the CPU faster than the disk?
    By matthew180 in forum C Programming
    Replies: 4
    Last Post: 06-06-2007, 03:23 PM
  2. Timers
    By Deb in forum C Programming
    Replies: 16
    Last Post: 04-23-2007, 10:15 AM
  3. Don't understand part of the source... Help!
    By tggqqa in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2007, 10:33 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. source style recommendations: in search of...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-04-2001, 07:51 PM