如何用C语言打开网站?

2025-02-28 09:26:14
推荐回答(3个)
回答1:

参考代码如下:

#include 
int main(void)
{
    ShellExecute(NULL, "open", "http://www.baidu.com", NULL, NULL, SW_MINIMIZE);
    return 0;
}

例子中是最小化打开的,还可以是最大化SW_MAXIMIZE,隐藏SW_HIDE等。

回答2:

#include
#include
#include
int main()
{
puts("请输入网址:");
char cmd[200];
strcpy(cmd,"start ");
scanf("%s",cmd+6);
system(cmd);
return 0;
}

回答3:

char w=null; scanf("%c",&w); if(w!=null) { w="start"+w; system(w); }