Is there a Linux equivalent to the following Win32 statement?
It displays a web page from within an appCode:ShellExecute(NULL, "open", "http://myplace.com/forum/myforum",NULL, NULL,SW_SHOWNORMAL);
Thanx
Printable View
Is there a Linux equivalent to the following Win32 statement?
It displays a web page from within an appCode:ShellExecute(NULL, "open", "http://myplace.com/forum/myforum",NULL, NULL,SW_SHOWNORMAL);
Thanx
Hi
Maybe this will be useful for you, if you just want to display a web page with a browser. Or, you can use the same way I used, to call any function.
Run the program from command line by passing the address of the page you want to display.Code:#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int foo(char *adr[])
{
pid_t pid;
pid=fork();
if (pid==0)
{
if (execv("/usr/bin/mozilla",adr)<0)
return -1;
else
return 1;
}
else if(pid>0)
return 2;
else
return 0;
}
int main(int argc,char *argv[])
{
if (foo(argv)<=0)
perror("foo");
return 0;
}
Your example is exactly what I need.
Thanx!
And what if mozilla suite isn't installed? How can I open a page in the default browser?
Just change the code for your favorite browser! You can make a search in the PATH to locate any possible browsers (mozilla, firefox, konqueror...)