-
open URL using C program
Hi All,
I was trying to open a url using a C program but unable to open
My program is
Code:
#include <stdio.h>
#include <stdlib.h>
void main()
{ clrscr();
system("C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.com");
getch();
}
result:
Bad Commnad or filename
Suggest me.....
Thanks
-
You need to escape the back slashes,
Code:
system("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE http://www.google.com");
BTW, if you want to open a URL in the users default browser use ShellExecute() (See MSDN).
-
Code:
system("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE http://www.google.com");
I tried with above system returns 0, but cant open any window....
where Am going wrong....
-
Try ShellExecute to open an URL. This will also open the URL in the default browser. Some people might get annoyed when you pop up an URL in IE rather than Firefox or Opera when they have one of those browsers set as default.
There was also another thread with ShellExecute back some time on how to open a web page I think. You can check that too.