home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12732 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  3.3 KB

  1. Path: sparky!uunet!tessi!aardvark!tyrant
  2. From: tyrant@Aardvark.Rain.COM (Rex Goode)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Shouldn't initgraph() work???
  5. Message-ID: <689@aardvark.Rain.COM>
  6. Date: 21 Aug 92 14:33:23 GMT
  7. References: <1992Aug20.003806.3641@desire.wright.edu>
  8. Organization: Steve's UNIX System, Portland, Oregon
  9. Lines: 71
  10.  
  11. achaboty@desire.wright.edu writes:
  12.  
  13. >    Bonjour.  I'm using BC++ 3.1 and can't get the function initgraph
  14. >to find the egavga.bgi file (I keep getting a -3 return value for gdriver
  15. >when initgraph is called).  I tried moving the program into the BGI
  16. >subdirectory and into the LIBRARY subdirectory, but neither one worked.  The
  17. >radio button to enable the graphics driver (option|linker|libraries) has
  18. >been checked and the program does compile, yet never wants to run.
  19. >    Even when I run the exmple program given by Borland (bgidemo.c), I
  20. >still get an error message.  I have tried just about everything I can think
  21. >of except the right way.
  22. >    Has anyone ever had a similar problem and what can I do to resolve
  23. >it?
  24. >    Thanks a lot!
  25.  
  26. I've had multiple problems linking and using Borland graphics drivers. One
  27. thing I would wonder in your situation is whether you are attempt to use
  28. the DETECT feature or whether you are specifying the EGAVGA. I never got
  29. DECTECT to work. Make sure of your upper/lower case spelling.
  30.  
  31. I don't know what I'm doing that makes it work now. Can't remember what I was
  32. doing before it started working for me.
  33.  
  34. There is a program called BGIOBJ which converts .BGI files to .OBJ files
  35. that added to GRAPHICS.LIB and then linked into your program. Then you use
  36. the registerbgidriver() function to the program to get the driver from the
  37. library rather than from the BGI subdirectory. I like this approach much
  38. better.
  39.  
  40. >P.S.  Is it possible to link any .obj file with a C++ .obj file?
  41. >   Specifically a turbo basic program used to control a BOCA printer?  If so,
  42. >   how can this be done, or would it be possible to execute that TB program
  43. >   while still running the C++ .exe?  Thanks again for your help.
  44.  
  45. >                --- Andrew
  46.  
  47. You can mix languages, but the basic program must conform to C++ rules for
  48. functions somehow. The Turbo basic program must be a SUB, i.e.,
  49.  
  50.   SUB functionname(param%, ,param!, param#) STATIC
  51.   .
  52.   .
  53.   .
  54.   END SUB
  55.  
  56. Then with C++, you could:
  57.  
  58.   int p1;
  59.   float p2;
  60.   double p3;
  61.   
  62.   functionname(p1, p2, p3);
  63.  
  64. There may be other steps prior to linking about which you would need to
  65. read in the manuals that come with your compilers. I haven't tried the
  66. above. Just wanted to give you something to experiment with.
  67.  
  68. Also, you can use the system() function to shell to DOS and run another
  69. program. Be careful if you are trying to do so within the integrated
  70. environment of Turbo C++. There may not be enough room in memory for the
  71. editor, the program, a second version of DOS and the second program. You
  72. can, however, run from DOS usually. That was a big mistake I've made in
  73. the past, thinking the system() command just doesn't work, when it worked
  74. fine outside of Turbo C++ editor.
  75.  
  76.   
  77. -- 
  78. ----------------------------------------------------------------------------
  79. Stephen Rex Goode        | But common men must have their cheap marvels    |
  80. tyrant@aardvark.rain.com | and wonders. - H.G. Wells                       |
  81. ----------------------------------------------------------------------------
  82.