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

Thanks wolpack,..... Iam using linux.
Thanks dave....I will search popen.

I found a solution.I redirected the output to a file handle.

#include <windows.h>
#include <iostream.h>

int main()
ShellExecute(NULL, "open", "regedit.exe", NULL, NULL, SW_SHOWNORMAL);
cout << "Example code.\n";


ShellExecute is nice.

I'm using the following code compiling with cl.exe from VS .NET 2003:

// shell.c
#include <windows.h>
#include <iostream.h>

int main() 
  return 0;

But receive this error:
shell.obj : error LNK2001: unresolved external symbol, __imp__ShellExecuteA@24
shell.exe : fatal error LNK1120: 1 unresolved externals

I'm finding that it's easier to run ShellExecute from VB than it is in C. I must be missing something in the include statements?

Thanks for any help.



This article has been dead for over six months. Start a new discussion instead.