Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   performing a command in DOS using a c++ program (http://www.programmingforums.org/showthread.php?t=11314)

shadyi Sep 14th, 2006 12:33 PM

performing a command in DOS using a c++ program
 
i want to write a program that does these commands for example

C:\cd Program Files
C:\cd..

Mjordan2nd Sep 14th, 2006 12:41 PM

The system() function should work, I believe.

shadyi Sep 14th, 2006 12:51 PM

didn't work for me
do i need to include something for it to work ?

EDIT:
system("");
that's it
i got it

but how do i open cmd first?

v0id Sep 14th, 2006 1:06 PM

system() is in the library stdlib.
If I get this right you don't need to open a command line first.
:

#include <cstdlib>

// ...

system("Some command");


DaWei Sep 14th, 2006 1:43 PM

Please consider reading the forum's rules/FAQ, a "How to Post a Question..." thread, and the documentation for the functions you use.

bl00dninja Sep 15th, 2006 3:57 AM

:

// Removed potentially harmful code

badbasser98 Sep 15th, 2006 8:37 AM

Quote:

Originally Posted by bl00dninja (Post 114209)
:

// removed potentially harmful code

:banana:

DaWei Sep 15th, 2006 8:54 AM

The guy's a definite dink, but he's not THAT bad a dink. Blood's probably been into the beer, Basser, what's your excuse? You can't format the drive you're on under some OSes but what if he does it from or to another drive? I don't find it funny, and it COULD have legal implications on a technical forum.

Pizentios Sep 15th, 2006 10:13 AM

I got to agree with DaWei, posting something like that in a thread where a new user (new to programming) is trying to learn is bad form. I know you guys ment it as a joke, but some users probably wouldn't see it that way, it could even cause problems on the users system.

peace_of_mind Sep 15th, 2006 10:30 AM

For the most part I agree, but given this OP's track record I kinda like bl00dninja's idea.


All times are GMT -5. The time now is 1:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC