C++ 网络浏览器turboc++;
所以我在网上浏览一个项目,偶然发现了这段代码。它运行完美,直到你进入一个网站(包括“www”:P)并按下回车键,然后砰的一声!程序终止,没有错误消息,什么也没有C++ 网络浏览器turboc++;,c++,browser,web,dev-c++,turbo-c++,C++,Browser,Web,Dev C++,Turbo C++,所以我在网上浏览一个项目,偶然发现了这段代码。它运行完美,直到你进入一个网站(包括“www”:P)并按下回车键,然后砰的一声!程序终止,没有错误消息,什么也没有 #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <graphics.h> #include <dos.h> #include <string.h> void initialize
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
#include <dos.h>
#include <string.h>
void initialize_graphics_mode();
int get_key();
void draw();
union REGS i, o;
main()
{
int key, i = 0, xpos, ypos, button;
char arr[200], temp[5], *ptr;
char a[] = "C:\\Progra~1\\Mozill~1\\firefox ";
strcpy(arr,a);
i = strlen(a);
initialize_graphics_mode();
draw();
while(1)
{
if(kbhit())
key = get_key();
if((key>=97&&key<=122)||(key>=65&&key<=90)||key==46||key==47||key==63)
{
arr[i] = key;
sprintf(temp,"%c",arr[i]);
outtext(temp);
if(getx()>470)
{
clearviewport();
moveto(5,2);
}
i++;
}
else if ( key == 13 )
{
arr[i] = '\0';
system(arr);
break;
}
else if ( key == 27 )
{
closegraph();
exit(EXIT_SUCCESS);
}
if(button==1&&xpos>=150&&xpos<=480&&ypos>=300&&ypos<=330)
{
system("C:\\Progra~1\\Mozill~1\\firefox programmingsimplified.com");
break;
}
key = -1;
}
closegraph();
return 0;
}
void initialize_graphics_mode()
{
int gd = DETECT, gm, errorcode;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
errorcode = graphresult();
if( errorcode != grOk )
{
printf("Graphics error : %s\n",grapherrormsg(errorcode));
printf("Press any key to exit...\n");
getch();
exit(EXIT_FAILURE);
}
}
int get_key()
{
i.h.ah = 0;
int86(22,&i,&o);
return( o.h.al );
}
void draw()
{
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(275,11,"Web Browser");
outtextxy(155,451,"<a> href=http://www.programmingsimplified.com"">www.programmingsimplified.com</a>");
outtextxy(5,105,"Enter URL : ");
rectangle(120,100,600,130);
setviewport(121,101,599,129,1);
moveto(5,1);
}
#包括
#包括
#包括
#包括
#包括
#包括
无效初始化_图形_模式();
int get_key();
无效抽取();
工会条例i、o;
main()
{
int键,i=0,xpos,ypos,按钮;
字符arr[200],温度[5],*ptr;
char a[]=“C:\\Progra~1\\Mozill~1\\firefox”;
strcpy(arr,a);
i=斯特伦(a);
初始化_图形_模式();
draw();
而(1)
{
if(kbhit())
key=get_key();
如果((键>=97&&key=65&&key470)
{
clearviewport();
moveto(5,2);
}
i++;
}
否则如果(键==13)
{
arr[i]='\0';
系统(arr);
打破
}
否则如果(键==27)
{
closegraph();
退出(退出成功);
}
如果(Button=1和& XPOS)=150 & & XPOS=300 & & YOPSTEP 1:卸载Turbo C++步骤2:安装一个现代ID/CiMuleS..……图形。h在DEV-C++(奥威尔)中不起作用。.而且,我的学校不允许修改编译器!fml@CoryKramerTurbo-C++?1992年的编译器?@Borgeader我做了!不管怎样,如果他们修改了它,那很酷,但在此之前我必须坚持使用turbo,这段代码是为turbo C编写的,所以,它应该可以工作,不是吗?你真的不是在创建浏览器。这些代码似乎只是在调用FireFo然后插入一个网站打开。系统
呼叫仍然可用,我想这就是你真正要做的。