function in graphics.h

1

I'm trying to learn a bit more about the libraries in C / C ++ to do more things so I went behind the graphics.h 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 requested and closed

    
asked by anonymous 28.11.2014 / 03:59

1 answer

1

I was having the same problem, even installing graphics.h correctly, the code was compiled and a few seconds after it appeared, the console screen stopped responding from scratch, I discovered that the problem was the file " libbgi.a " , try downloading this and replace it in the folder " lib "of the compiler.

    
03.10.2015 / 03:32