From: tyrant@Aardvark.Rain.COM (Rex Goode)
Newsgroups: comp.lang.c++
Subject: Re: Shouldn't initgraph() work???
Date: 21 Aug 92 14:33:23 GMT
Organization: Steve's UNIX System, Portland, Oregon

achaboty@desire.wright.edu writes:

>	Bonjour.  I'm using BC++ 3.1 and can't get the function initgraph
>to find the egavga.bgi file (I keep getting a -3 return value for gdriver
>when initgraph is called).  I tried moving the program into the BGI
>subdirectory and into the LIBRARY subdirectory, but neither one worked.  The
>radio button to enable the graphics driver (option|linker|libraries) has
>been checked and the program does compile, yet never wants to run.
>	Even when I run the exmple program given by Borland (bgidemo.c), I
>still get an error message.  I have tried just about everything I can think
>of except the right way.
>	Has anyone ever had a similar problem and what can I do to resolve
>it?
>	Thanks a lot!

I've had multiple problems linking and using Borland graphics drivers. One
thing I would wonder in your situation is whether you are attempt to use
the DETECT feature or whether you are specifying the EGAVGA. I never got
DECTECT to work. Make sure of your upper/lower case spelling.

I don't know what I'm doing that makes it work now. Can't remember what I was
doing before it started working for me.

There is a program called BGIOBJ which converts .BGI files to .OBJ files
that added to GRAPHICS.LIB and then linked into your program. Then you use
the registerbgidriver() function to the program to get the driver from the
library rather than from the BGI subdirectory. I like this approach much
better.

>P.S.  Is it possible to link any .obj file with a C++ .obj file?
>   Specifically a turbo basic program used to control a BOCA printer?  If so,
>   how can this be done, or would it be possible to execute that TB program
>   while still running the C++ .exe?  Thanks again for your help.

>				--- Andrew

You can mix languages, but the basic program must conform to C++ rules for
functions somehow. The Turbo basic program must be a SUB, i.e.,

  SUB functionname(param%, ,param!, param#) STATIC
  .
  .
  .
  END SUB

Then with C++, you could:

  int p1;
  float p2;
  double p3;
  
  functionname(p1, p2, p3);

There may be other steps prior to linking about which you would need to
read in the manuals that come with your compilers. I haven't tried the
above. Just wanted to give you something to experiment with.

Also, you can use the system() function to shell to DOS and run another
program. Be careful if you are trying to do so within the integrated
environment of Turbo C++. There may not be enough room in memory for the
editor, the program, a second version of DOS and the second program. You
can, however, run from DOS usually. That was a big mistake I've made in
the past, thinking the system() command just doesn't work, when it worked
fine outside of Turbo C++ editor.

  
-- 
----------------------------------------------------------------------------
Stephen Rex Goode        | But common men must have their cheap marvels    |
tyrant@aardvark.rain.com | and wonders. - H.G. Wells                       |
----------------------------------------------------------------------------