1
I’m trying to learn a little more from C/C++ libraries to do more things so I went after the Graphics library. and went after the most basic code I found, which was:
#include <graphics.h>
int main(){
int gdriver = DETECT, gmode, errorcode;
char *str = new char[30];
strcpy(str, "d:\\tc\\bgi");
initgraph(&gdriver,&gmode, str);
arc(200, 200, 0, 130, 50);
closegraph();
return 0;
}
What happens is that the program compiled, opened, stopped responding without executing what I asked and closed
"without executing what I asked for"'? Try running the program in debug mode, instruction and instruction.
– pmg
No, it doesn’t really run, I used system("PAUSE"); and it doesn’t even run the command, then I debugged in hand passing several lines as a comment and found that the error is in the initgraph function();
– Pedro Zanutto
One remark: It is a good practice to initialize variables. What is the value of the variable gmode?
– jlHertel
I understand it is, but like I said, I just copied what the guy did, for it worked and for me not.
– Pedro Zanutto