turbo c++ graphics closes on execution
Page 1 of 114 Replies - 3585 Views - Last Post: 30 January 2011 - 05:35 AM
#1 Guest_The Intel*
turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:23 AM
Help me rectify the problem ASAP as I need it for doing the project.
Replies To: turbo c++ graphics closes on execution
#2
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:30 AM
#3
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:30 AM
Can you tell us which API you are using, as well as post the code?
#4 Guest_The Intel*
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:33 AM
This post has been edited by JackOfAllTrades: 29 January 2011 - 12:39 PM
Reason for edit:: Removed unnecessary quote
#5
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:35 AM
http://www.dreaminco...60&#entry893260
#6 Guest_The Intel*
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:37 AM
The Intel, on 29 January 2011 - 10:33 AM, said:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 100;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
/* draw the circle */
circle(midx, midy, radius);
/* clean up */
getch();
closegraph();
return 0;
}
This post has been edited by ButchDean: 29 January 2011 - 10:40 AM
#7
#8 Guest_Guest*
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:42 AM
This post has been edited by JackOfAllTrades: 29 January 2011 - 12:39 PM
Reason for edit:: Removed unnecessary quote
#9
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:43 AM
The Intel, on 29 January 2011 - 05:37 PM, said:
The Intel, on 29 January 2011 - 10:33 AM, said:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 100;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
/* draw the circle */
circle(midx, midy, radius);
/* clean up */
getch();
closegraph();
return 0;
}
Turbo C++ is so old that I don't have it installed either. Have you debugged to see what is happening exactly? For instance do you know if
if (errorcode != grOk)
Is true causing the program to terminate?
#10 Guest_The Intel*
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:46 AM
This post has been edited by JackOfAllTrades: 29 January 2011 - 12:38 PM
Reason for edit:: Removed unnecessary quote
#11
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:51 AM
try running the .exe file from the Windows Command Prompt - it is probably not finding the .BGI files which drives the grapics
#12
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 10:54 AM
The Intel, on 29 January 2011 - 05:46 PM, said:
Then you are failing to initialize your graphics, hence the fact that they fail to show. When you debug that is the value of gdriver and gmode? Also does initgraph return any error codes?
#13 Guest_The Intel*
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 11:01 AM
ButchDean, on 29 January 2011 - 10:54 AM, said:
The Intel, on 29 January 2011 - 05:46 PM, said:
Then you are failing to initialize your graphics, hence the fact that they fail to show. When you debug that is the value of gdriver and gmode? Also does initgraph return any error codes?
Didn't quite get your first question.
On compilation, there are no errors whatsoever. On pressing alt + f7 that is, it checks for errors and finds absolutely none.
#14
Re: turbo c++ graphics closes on execution
Posted 29 January 2011 - 11:03 AM
The Intel, on 29 January 2011 - 06:01 PM, said:
ButchDean, on 29 January 2011 - 10:54 AM, said:
The Intel, on 29 January 2011 - 05:46 PM, said:
Then you are failing to initialize your graphics, hence the fact that they fail to show. When you debug that is the value of gdriver and gmode? Also does initgraph return any error codes?
Didn't quite get your first question.
On compilation, there are no errors whatsoever. On pressing alt + f7 that is, it checks for errors and finds absolutely none.
horace got it working. Have you tried their suggestion?
#15 Guest_The Intel*
Re: turbo c++ graphics closes on execution
Posted 30 January 2011 - 05:35 AM
ButchDean, on 29 January 2011 - 11:03 AM, said:
The Intel, on 29 January 2011 - 06:01 PM, said:
ButchDean, on 29 January 2011 - 10:54 AM, said:
The Intel, on 29 January 2011 - 05:46 PM, said:
Then you are failing to initialize your graphics, hence the fact that they fail to show. When you debug that is the value of gdriver and gmode? Also does initgraph return any error codes?
Didn't quite get your first question.
On compilation, there are no errors whatsoever. On pressing alt + f7 that is, it checks for errors and finds absolutely none.
horace got it working. Have you tried their suggestion?
For me, the screen becomes pitch dark if I try running it from the exe file.
|
|

New Topic/Question
Reply
MultiQuote











|