4 Replies - 7986 Views - Last Post: 27 March 2008 - 05:09 AM Rate Topic: -----

#1 rajendra8387  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 25-March 08

how to run dos commands in c-program

Post icon  Posted 25 March 2008 - 10:01 AM

hiiiiiiiii,tell me how to run dos commands in c-program
Is This A Good Question/Topic? 1

Replies To: how to run dos commands in c-program

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how to run dos commands in c-program

Posted 25 March 2008 - 10:20 AM

You can use the system() function to run commands you would normally run via the command line interface. Of course, depending on your operating system, the goal may better be accomplished via a fork() if you need to grab the output (or any errors).
Was This Post Helpful? 1

#3 bodom658  Icon User is offline

  • Villiage Idiom
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,123
  • Joined: 22-February 08

Re: how to run dos commands in c-program

Posted 25 March 2008 - 10:29 AM

and if you are running windows, don't forget to include windows.h
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how to run dos commands in c-program

Posted 25 March 2008 - 10:53 AM

The system command is located in the stdlib.h library.
Was This Post Helpful? 0
  • +
  • -

#5 bodom658  Icon User is offline

  • Villiage Idiom
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,123
  • Joined: 22-February 08

Re: how to run dos commands in c-program

Posted 27 March 2008 - 05:09 AM

Touche... My bad
Was This Post Helpful? 1

Page 1 of 1