|
-
Jan 7th, 2006, 06:44 AM
#1
Thread Starter
Fanatic Member
How to use the command promp from C++?
Hello!!!
I want to execute a command from c++ as if it was executed from the
command prompt...
how can I do that?
thanks!!
-
Jan 7th, 2006, 06:54 AM
#2
Addicted Member
Re: How to use the command promp from C++?
try something like this
Code:
system("start notepad");
or
#Appreciate others by rating good posts !!
#The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.
#People who are still ignorant of their ignorance are dangerous.
-
Jan 8th, 2006, 05:58 PM
#3
Thread Starter
Fanatic Member
Re: How to use the command promp from C++?
is that for visual c++ .Net or for native c++?
-
Jan 8th, 2006, 09:24 PM
#4
Addicted Member
Re: How to use the command promp from C++?
I tired this in VC6.0...from next time do mention your requirements completely
#Appreciate others by rating good posts !!
#The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.
#People who are still ignorant of their ignorance are dangerous.
-
Jan 9th, 2006, 12:37 PM
#5
Thread Starter
Fanatic Member
Re: How to use the command promp from C++?
do I need to include any class to use this command?
because my sytem doesn't recognise it...
Last edited by dekelc; Jan 9th, 2006 at 12:51 PM.
Dekel C.
-
Jan 9th, 2006, 01:18 PM
#6
Re: How to use the command promp from C++?
For C++, include <cstdlib> and use std::system().
For C, include <stdlib.h> and use system().
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Jan 12th, 2006, 05:59 AM
#7
Lively Member
Re: How to use the command promp from C++?
Just curious what does the system function do generally?
-
Jan 12th, 2006, 06:03 AM
#8
Re: How to use the command promp from C++?
It passes the string you give it to "the system shell" (whatever that is) for execution.
In Linux, this usually means the Bourne Shell, /bin/sh. In Windows, it means cmd.exe.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 12th, 2006, 06:09 AM
#9
Lively Member
Re: How to use the command promp from C++?
 Originally Posted by CornedBee
It passes the string you give it to "the system shell" (whatever that is) for execution.
In Linux, this usually means the Bourne Shell, /bin/sh. In Windows, it means cmd.exe.
ok,I understood that partially,does it mean that it executes whatever file or string I put in it?
-
Jan 12th, 2006, 06:32 AM
#10
Re: How to use the command promp from C++?
No. "It passes it to the shell" means exactly that.
If you want to know what it does, select Start->Run, type "cmd", and in the window that opens, type whatever you want to pass to system().
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 12th, 2006, 06:36 AM
#11
Addicted Member
Re: How to use the command promp from C++?
#Appreciate others by rating good posts !!
#The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.
#People who are still ignorant of their ignorance are dangerous.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|