Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 4th, 2005, 07:01 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default graphics in C++

I have problem connected with activete library (graphics.h)
under rhide (compilator C++). I set in motion programm with
help and are problems (BGI graphics not ANSI compatible) and
not identifity functions contents in this library. My programm:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int xmax, ymax;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }

   setcolor(getmaxcolor());
   xmax = getmaxx();
   ymax = getmaxy();

   /* draw a diagonal line */
   line(0, 0, xmax, ymax);

   /* clean up */
   getch();
   closegraph();
   return 0;
}
(*)Where is error?

Reply With Quote
  #2 (permalink)  
Old November 6th, 2005, 09:10 PM
Authorized User
 
Join Date: Nov 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Paramesh
Default

Your error message itself says this:
"BGI graphics not ANSI compatible"

The graphics you used is not a standard C/c++ code. It is not ANSI or ISO code.

You can try compiling it in Turbo C++ instead.

Regards,
Paramesh.

"Don't walk behind me; I may not lead.
 Don't walk in front of me; I may not follow.
 Just walk beside me and be my friend."
Reply With Quote
  #3 (permalink)  
Old November 28th, 2005, 12:02 AM
Authorized User
 
Join Date: Nov 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you should need to specify the default path or path where egavga.bgi file exist...for example
Code:
initgraph(&gdriver, &gmode, "\\tc\\bgi");

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
c/c++ graphics hafizmuhammadmushtaq C++ Programming 0 October 19th, 2007 11:33 PM
graphics in c++ himutg C++ Programming 1 December 12th, 2006 08:22 AM
Help on graphics steparths C++ Programming 0 June 30th, 2006 02:09 PM
Graphics Control Dataman Access 2 March 5th, 2004 03:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.