[comp.lang.c] Auto Search for BGI in Turbo C

tabu6@CCVAX.IASTATE.EDU (Adam Goldberg) (03/18/91)

In article <65841@eerie.acsu.Buffalo.EDU>, haozhou@acsu.buffalo.edu (Hao Zhou) writes:
>I wrote an application program using Turbo C graphics package. The
>only problem I have is that I have to keep the BGI driver in the
>current directory otherwise the program will say the BGI driver is not
>found. 
>
>My question is how do I tell my program to search for the BGI driver
>in a path specified somehow if the BGI driver is not present in the
>current directory?
>

It is possible to link the BGI driver in with the executable code (EXE file), 
by:
  o  Using the BGIOBJ utility to create an OBJ verion of the BGI driver
  o  LINKing the OBJ BGI driver with your code OBJ file
  o  Doing either a 'registerbgidriver()' or 'registerfarbgidriver()' function
     call before the 'initgraph()' call.

(Consult your manual for further info--though I got this from the Waite Group's
Turbo C++ Bible -- these functions work in TC2.0 as well).

------------

Part II:

  if(a=b) { 
            ... }

 has legitimate use.  This is a non-atomic slightly modified TestAndSet.


+----------------------------------------------------------------------------+
+ Adam Goldberg                         H:(515)233-5135                      +
+ Iowa State University                 TABU6@ccvax.iastate.edu              +
+ "It's simple!  Even a Pascal programmer could do it!"                      +
+----------------------------------------------------------------------------+

hagins@gamecock.rtp.dg.com (Jody Hagins) (03/20/91)

In article <1991Mar17.162020.6858@news.iastate.edu>, tabu6@CCVAX.IASTATE.EDU (Adam Goldberg) writes:
|> In article <65841@eerie.acsu.Buffalo.EDU>, haozhou@acsu.buffalo.edu (Hao Zhou) writes:
|> >I wrote an application program using Turbo C graphics package. The
|> >only problem I have is that I have to keep the BGI driver in the
|> >current directory otherwise the program will say the BGI driver is not
|> >found. 
|> >
|> >My question is how do I tell my program to search for the BGI driver
|> >in a path specified somehow if the BGI driver is not present in the
|> >current directory?
|> >
|> 
|> It is possible to link the BGI driver in with the executable code (EXE file), 
|> by:
|>   o  Using the BGIOBJ utility to create an OBJ verion of the BGI driver
|>   o  LINKing the OBJ BGI driver with your code OBJ file
|>   o  Doing either a 'registerbgidriver()' or 'registerfarbgidriver()' function
|>      call before the 'initgraph()' call.
|> 
|> (Consult your manual for further info--though I got this from the Waite Group's
|> Turbo C++ Bible -- these functions work in TC2.0 as well).




I use an environment variable BGI_DIR.  If it's set, I use it.  Otherwise,
I use the current directory.


-- 

Jody Hagins             
hagins@gamecock.rtp.dg.com    
Data General Corp.      
62 Alexander Dr.        
RTP, N.C.  27709        
(919) 248-6035          

Nothing I ever say reflects the opinions of DGC.

woiccak@acsu.buffalo.edu (thomas s woiccak) (03/20/91)

getting off the "accessing BGI driver" question, How does one access an
environment variable from a C/C++ program? I know there is a simple 
solution, but...

Tom Woiccak
-- 
-Thomas S. Woiccak,  State Univ. of New York at Buffalo, Dept. of Comp. Sci.
   INTERNET: woiccak@acsu.buffalo.edu
   BITNET: woiccak%acsu.buffalo.edu@ubvm.bitnet , v058p7u4@ubvms.bitnet
   UUCP: ...!{rutgers,uunet}!acsu.buffalo.edu!woiccak   

mouse@thunder.mcrcim.mcgill.edu (der Mouse) (03/23/91)

In article <66461@eerie.acsu.Buffalo.EDU>, woiccak@acsu.buffalo.edu (thomas s woiccak) writes:
> How does one access an environment variable from a C/C++ program?

char *getenv(char *varname);

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu