comman line command
Hi all,
Can anyone suggest me commands which will take a given thing and execute it in the command line and return the output. system() doesnt suit me bcos
1.it returns int not entire output
2.it opens command line window(shell) ( I dont want to open the window or display the output in a window).
thanks for any help
kararu
Junior Poster in Training
50 posts since Sep 2006
Reputation Points: 20
Solved Threads: 0
If you are using Windows, try ShellExecute.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Can anyone suggest me commands which will take a given thing and execute it in the command line and return the output. system() doesnt suit me bcos
1.it returns int not entire output
2.it opens command line window(shell) ( I dont want to open the window or display the output in a window).
You may want to search for popen . http://www.daniweb.com/techtalkforums/showthread.php?t=54481
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Thanks wolpack,..... Iam using linux.
Thanks dave....I will search popen.
kararu
Junior Poster in Training
50 posts since Sep 2006
Reputation Points: 20
Solved Threads: 0
I found a solution.I redirected the output to a file handle.
kararu
Junior Poster in Training
50 posts since Sep 2006
Reputation Points: 20
Solved Threads: 0
#include <windows.h>
#include <iostream.h>
int main()
{
ShellExecute(NULL, "open", "regedit.exe", NULL, NULL, SW_SHOWNORMAL);
cout << "Example code.\n";
system("PAUSE");
}
ShellExecute is nice.
Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1