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

If you are using Windows, try ShellExecute.

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

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";

system("PAUSE");
}

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() 
{
  SHELLEXECUTE (NULL, "open", "Notepad.exe", NULL, NULL, SW_SHOWNORMAL);
  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.

Regards,

Hank