Thread: new to borland/get error

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    479

    new to borland/get error

    i just got Borland

    and wrote this code which is meant to be used with
    turbo c++
    i got borland 5.0

    Code:
    /*initgraph example a simple program to demonstrate the init graph and draw a line
    from on diagonal of the screen to the other*/
    #include <graphics.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <conio.h>
    
    int main(void)
    {
    	/* request auto detection */
    	int gdriver = DETECT, gmode, errorcode;
    
    	/* initialize graphics mode */
    	initgraph(&gdriver, &gmode, "C:\\tc\\bgi");// yes i  
                                                                                       //changed  
                                                     //this to my borland bgi folder 
    	/* read result of initialization */
    	errorcode = graphresult();
    
    	if (errorcode != grOk) /* an error occured */
    	{
    		printf("Graphics error: %s\n", grapherrormsg(errorcode));
    		printf("Press any key to halt:");
    		getch();
    		exit(1);				  /* return with error code */
    	}
    
    	/* draw a line from (0,0) to (max X, max Y)*/
    	int x=getmaxx()/2, y=getmaxy()/2;
    	bar(x-10,y-10,x+10,y+10);
    
    	/* clean up*/
    	getch();
    	getch();
    	/* two getch() needed as characters will carry through the buffer some
    	keystrokes can carry through the buffer*/
    	closegraph();
    	return 0;

    // i get error saying BGI graphics not supported under windows
    //thanks in advance

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    there are two possibilites here

    1. borland no longer supports graphics on windows
    2. your using an incompatible version on windows.

    more likely 1 but,
    what version of windows are you using?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    xp

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    try running your program directly in compatibility mode for Win95 or 98
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    how

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    navigate to the your programs exe in explorer right click on your .exe select properties at the bottom of the menu click the compatibility tab go to the compatibility mode area click the check box on "Run this program in compatibility for:" and select the appropriate OS.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    i dont have the turbo c++
    i use borland c++ 5.0

    anyone know what i should do to mke it work?

  8. #8
    Unregistered
    Guest
    dont know!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM