GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Nov-2004, 19:17
FeebleWizard FeebleWizard is offline
New Member
 
Join Date: Nov 2004
Posts: 6
FeebleWizard is on a distinguished road
Question

EGAVGA.bgi right in front of my computer's nose!


Hello, I need help using graphics. I have Borland Turbo C++ 3.0 and whenever I try to use a graphics screen, I get the error, “Device driver file not found (EGAVGA.bgi).” The file egavga.big exists in the BGI folder, but the computer will not read it. I placed a copy of egavga.bgi into each of the zipped-up folders, but I still can not use graphics, even after I reinstalled the Turbo C++ 3.0. LOL, I also tried all of the different options under libraries etc. The directories section looked like it might be important in this puzzle, but I was unable to figure anything out. Finally, I tried using Google to investigate this problem, but could not come to a solution. Somehow, it seems that a mysterious program called “BGIOBJ.exe” residing in the BGI folder may be somehow connected to this strange problem in some way I do not understand; however, I am not too sure. I keep double-clicking on it but it just turns the screen black for a second. Maybe it is supposed to be triggered while the program is still running. Does anyone here know much about these sorts of things? Any help would be greatly appreciated!
  #2  
Old 01-Dec-2004, 00:47
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,244
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Are you using calls to registerbgidriver() and/or initgraph()?

It's really hard to tell what might be wrong with knowing what you're doing.
__________________

Age is unimportant -- except in cheese
  #3  
Old 01-Dec-2004, 13:37
Jags's Avatar
Jags Jags is offline
New Member
 
Join Date: May 2004
Posts: 13
Jags is on a distinguished road
Quote:
Originally Posted by FeebleWizard
Hello, I need help using graphics. I have Borland Turbo C++ 3.0 and whenever I try to use a graphics screen, I get the error, “Device driver file not found (EGAVGA.bgi).” The file egavga.big exists in the BGI folder, but the computer will not read it. I placed a copy of egavga.bgi into each of the zipped-up folders, but I still can not use graphics, even after I reinstalled the Turbo C++ 3.0. LOL, I also tried all of the different options under libraries etc. The directories section looked like it might be important in this puzzle, but I was unable to figure anything out. Finally, I tried using Google to investigate this problem, but could not come to a solution. Somehow, it seems that a mysterious program called “BGIOBJ.exe” residing in the BGI folder may be somehow connected to this strange problem in some way I do not understand; however, I am not too sure. I keep double-clicking on it but it just turns the screen black for a second. Maybe it is supposed to be triggered while the program is still running. Does anyone here know much about these sorts of things? Any help would be greatly appreciated!

i will be much easier to solve your problem if you can post the code
  #4  
Old 01-Dec-2004, 16:05
FeebleWizard FeebleWizard is offline
New Member
 
Join Date: Nov 2004
Posts: 6
FeebleWizard is on a distinguished road
Thank you for your replies. Sorry, I should have included the code. I just copied examples from the Borland "Help" files, and nothing would work. Since everything had the same problem, I just thought that it must be that the file were not right, but I was probably wrong about that. Here is the program to demonstrate the rectangle function.

CPP / C++ / C Code:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int left, top, right, bottom;

   /* 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 */
   }

   left = getmaxx() / 2 - 50;
   top = getmaxy() / 2 - 50;
   right = getmaxx() / 2 + 50;
   bottom = getmaxy() / 2 + 50;

   /* draw a rectangle */
   rectangle(left,top,right,bottom);

   /* clean up */
   getch();
   closegraph();
   return 0;
}

I'm new to C++ so I am trying use examples to learn the language. I used to use Pascal, but I quit because got stuck with an error very similar to this when I got a newer computer. I thought it was because Pascal was too ancient of a language, so I switched to C++.

....


Wow... I just figured this out myself again! I couldn't copy the program from the environment so I looked for it in its folder. But this was actually the installation folder. I could not find my file, so I used the Search. In this way I figured out that the real folder was under the C drive in the folder explorer. So I put the EGAVGA.bgi into the BIN folder, because I knew that that is where my program was, and now the graphics work!

Sorry I didn't realize this earlier, but thank you for your help. Between Pascal and very recently C++ this problem has dooged me for years!

....

Now I've tried to take the compiled 'exe' file out of its folder, and I got the same problem again. But a made a new folder and put a copy of the EXE in it along with a copy of EGAEVA.bgi, and now it works again. So this means that the files all have to be put in a file together to work!

This kind of stuff probably sounds silly because it is just common sense, but I just figured all of this out right now while writing this post, and I think I now understand a lot more about how computer programs work.

Thanks again for responding. Hopefully anyone who has this same problem (if anybody else is really that silly) will be helped by this post?
Last edited by LuciWiz : 07-Nov-2006 at 01:13. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #5  
Old 01-Dec-2004, 20:15
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,244
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
It's been a while, but I looked at some of my older programs and I noticed I used:
CPP / C++ / C Code:
initgraph(&gdriver, &gmode, "pathname-of-bgi-file");

Another way I've used it is convert the .bgi file to a .obj file (there's a Borland utility to do that) and compile it directly into the program. Look at the help to see if this gets you anywhere.
__________________

Age is unimportant -- except in cheese
  #6  
Old 02-Dec-2004, 09:01
Jags's Avatar
Jags Jags is offline
New Member
 
Join Date: May 2004
Posts: 13
Jags is on a distinguished road
change this line in your code:-
Quote:
initgraph(&gdriver, &gmode, "");

with this one:-
Quote:
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

where "c:\\tc\\bgi" is the pathname of your bgi-folder

remember DO NOT use single back-slash in pathname

you can replace the back-slash with a SINGLE forward slash
  #7  
Old 02-Dec-2004, 11:59
FeebleWizard FeebleWizard is offline
New Member
 
Join Date: Nov 2004
Posts: 6
FeebleWizard is on a distinguished road
Thumbs up


Thank you both very much. Doing that does work! My problem was that when I used "" it made the computer look into the BIN folder, I think. I had earlier tried replacing it with "C:\TP\BGI" but of course that did not work. Another entirely different way of solving this problem that I recently discovered was to just take the EGAVGA.bgi and put it right into the BIN file, but I'm glad that I now know the proper way to write a path! Thanks again!
  #8  
Old 02-Dec-2004, 23:07
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,244
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by Jags
change this line in your code:-
CPP / C++ / C Code:
 initgraph(&gdriver, &gmode, "");
with this one:-
CPP / C++ / C Code:
 initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
where "c:\\tc\\bgi" is the pathname of your bgi-folder

remember DO NOT use single back-slash in pathname

you can replace the back-slash with a SINGLE forward slash
Isn't that what I said? ;-)
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 3) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 12:10.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.