943,520 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 6104
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
May 7th, 2007
0

BGI graphics not supported in windows..

Expand Post »
hi!

i tried to run the following program in BORLAND C++ version 5.02..

C++ Syntax (Toggle Plain Text)
  1. #include<stdio.h>
  2. #include<graphics.h>
  3. #include<string.h>
  4. #include<math.h>
  5. #include<conio.h>
  6. int const monthcount=12,dataoffset=18;
  7.  
  8. struct indata
  9. {
  10. float realarray[ 12];
  11. float array[ 12];
  12. };
  13.  
  14. char getlabel[3];
  15. indata data;
  16. int monthplace[ 12];
  17. float interval,chartbottom,radius;
  18.  
  19. struct wcp
  20. {
  21. float x;
  22. float y;
  23. } coord[monthcount];
  24.  
  25. wcp center;
  26.  
  27. int round(float a)
  28. {
  29. int b;
  30. b=a;
  31. if(a-b>0.5)
  32. return ++b;
  33. else
  34. return b;
  35. }
  36.  
  37. void polyline(int x, wcp *y)
  38. {
  39. for(int i=0;i<x-1 ;i++)
  40. line(y[i].x,y[i].y,y[i+1].x,y[i+1].y);
  41. }
  42.  
  43. void getlab(int x)
  44. {
  45. switch(x)
  46. {
  47. case 0:
  48. {
  49. strcpy(getlabel,"JAN");
  50. break;
  51. }
  52. case 1:
  53. {
  54. strcpy(getlabel ,"FEB");
  55. break;
  56. }
  57. case 2:
  58. {
  59. strcpy(getlabel," MAR");
  60. break;
  61. }
  62. case 3:
  63. {
  64. strcpy(getlabel,"APR");
  65. break;
  66. }
  67. case 4:
  68. {
  69. strcpy(getlabel,"MAY");
  70. break;
  71. }
  72. case 5:
  73. {
  74. strcpy(getlabel,"JUN");
  75. break;
  76. }
  77. case 6:
  78. {
  79. strcpy(getlabel,"JUL");
  80. break;
  81. }
  82. case 7:
  83. {
  84. strcpy(getlabel,"AUG" );
  85. break;
  86. }
  87. case 8:
  88. {
  89. strcpy(getlabel,"SEP");
  90. break;
  91. }
  92. case 9:
  93. {
  94. strcpy(getlabel,"OCT");
  95. break;
  96. }
  97. case 10:
  98. {
  99. strcpy(getlabel,"NOV");
  100. break;
  101. }
  102. case 11:
  103. {
  104. strcpy(getlabel,"DEC");
  105. break;
  106. }
  107. }
  108. }
  109.  
  110. void getdata()
  111. {
  112. float t1=0.00,t2;
  113. for(int t=0;t<12;t++)
  114. {
  115. getlab(t);
  116. printf("ENTER THE DATA FOR THE MONTH OF %s: ",getlabel);
  117. scanf("%f",&data.realarray[t]);
  118. if(data.realarray[t]>t1 )
  119. {
  120. t1=data.realarray[t];
  121. }
  122. }
  123. for(t=0;t<12;t++)
  124. {
  125. t2=data.realarray[t]/t1;
  126. data.array[t]=t2*400;
  127. }
  128. }
  129.  
  130. void puttext(wcp textp)
  131. {
  132. settextstyle(1,HORIZ_DIR,1);
  133. outtextxy(textp.x,textp.y,getlabel);
  134. }
  135.  
  136. void drawlabels()
  137. {
  138. wcp textposition;
  139. textposition.y=chartbottom;
  140. int zz=25;
  141. for(int az=0;az<12;az++)
  142. {
  143. textposition.x=zz;
  144. zz+=50;
  145. getlab(az);
  146. puttext(textposition);
  147. }
  148. }
  149.  
  150. char valuep[5];
  151.  
  152. void findvaluep(int x)
  153. {
  154. int y=x,ttt;
  155. char tg[5];
  156. strcpy(tg,"");
  157. do
  158. {
  159. ttt=y%10;
  160. switch(ttt)
  161. {
  162. case 0:
  163. {
  164. strcat(tg,"0");
  165. break;
  166. }
  167. case 1:
  168. {
  169. strcat(tg,"1");
  170. break;
  171. }
  172. case 2:
  173. {
  174. strcat(tg,"2");
  175. break;
  176. }
  177. case 3:
  178. {
  179. strcat(tg,"3");
  180. break;
  181. }
  182. case 4:
  183. {
  184. strcat(tg,"4");
  185. break;
  186. }
  187. case 5:
  188. {
  189. strcat(tg,"5");
  190. break;
  191. }
  192. case 6:
  193. {
  194. strcat(tg,"6");
  195. break;
  196. }
  197. case 7:
  198. {
  199. strcat(tg,"7");
  200. break;
  201. }
  202. case 8:
  203. {
  204. strcat(tg,"8");
  205. break;
  206. }
  207. case 9:
  208. {
  209. strcat(tg,"9");
  210. break;
  211. }
  212. }
  213. y/=10;
  214. } while(y>0);
  215. strcpy(valuep,"");
  216. for(y=0;y<strlen(tg);y++)
  217. {
  218. valuep[y]=tg[strlen(tg)-y-1];
  219. }
  220. valuep[y]=NULL;
  221. }
  222.  
  223.  
  224. void linechart()
  225. {
  226. drawlabels();
  227. settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
  228. for(int t=0;t<monthcount;t++)
  229. {
  230. coord[t].x=monthplace[t];
  231. coord[t].y=450-data.array[t]-dataoffset;
  232. findvaluep(data.realarray[t]);
  233. outtextxy(coord[t].x,coord[t].y-10,valuep);
  234. }
  235. polyline(monthcount,coord);
  236. }
  237.  
  238. void main()
  239. {
  240. int gdriver=DETECT,gmode;
  241. initgraph(&gdriver,&gmode,"");
  242. getdata();
  243. cleardevice();
  244. chartbottom=450.0;
  245. interval=50.0;
  246. monthplace[0]=25;
  247. for(int z=1;z<monthcount;z++)
  248. monthplace[z]=monthplace[z-1 ]+interval;
  249. linechart();
  250. getch();
  251. cleardevice();
  252. closegraph();
  253. }

but it tells me that BGI graphics is not supported under windows..
what does this mean????????

i tried googling it, but couldn't understand how to solve it, all i came to know is that there is some other header file to be used..

now what should i do?.. if i am to change the header file, then where to get the new header file from? and how to use this??

i am new to graphics programming in Borland c++, so i am not able to understand much... hence, if possible plz give me the exact procedure to follow..

plz help me out..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
akmaahamed_2005 is offline Offline
27 posts
since Apr 2007
May 7th, 2007
0

Re: BGI graphics not supported in windows..

Which OS are you on and how were you trying to execute the program?
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
May 7th, 2007
0

Re: BGI graphics not supported in windows..

That error message seems pretty clear to me -- it means that your compiler can not compile that program because it contains code that is no longer supported. You will have to use an older Borland compiler, such as Turbo C.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,945 posts
since Aug 2005
May 7th, 2007
1

Re: BGI graphics not supported in windows..

BGI graphics was designed for earlier Borland compilers and won't work with 5.0+. So you have to rewrite the output portions of the program to remove the screen manipulation. Or you can find a graphics package you like and rewrite the output sections.
Moderator
Reputation Points: 3275
Solved Threads: 890
Posting Sage
WaltP is offline Offline
7,716 posts
since May 2006
Oct 3rd, 2009
-1

Re: BGI graphics not supported in windows..

Click to Expand / Collapse  Quote originally posted by WaltP ...
BGI graphics was designed for earlier Borland compilers and won't work with 5.0+. So you have to rewrite the output portions of the program to remove the screen manipulation. Or you can find a graphics package you like and rewrite the output sections.
there is a folder named BGI in the directory of Borland C++ 4.5 ,,,however i get the same problem "BGI graphics not supported under windows"--while compiling my project.....has it anything to do with my operating system ---i am using Windows Vista..??
Last edited by noddytoddy; Oct 3rd, 2009 at 2:24 pm.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
noddytoddy is offline Offline
1 posts
since Aug 2009
Oct 3rd, 2009
1

Re: BGI graphics not supported in windows..

You would be better served by starting a new thread as this one is over 2 years old
Moderator
Featured Poster
Reputation Points: 1142
Solved Threads: 982
Most Valuable Poster
crunchie is online now Online
12,162 posts
since Feb 2004
Oct 3rd, 2009
-6

Re: BGI graphics not supported in windows..

Click to Expand / Collapse  Quote originally posted by noddytoddy ...
there is a folder named BGI in the directory of Borland C++ 4.5 ,,,however i get the same problem "BGI graphics not supported under windows"--while compiling my project.....has it anything to do with my operating system ---i am using Windows Vista..??
Yes. You are using a 15 year old compiler! That compiler doesnt support windows NT.

Quote ...
Borland C++ 4.52 - (1995) Official support for Windows 95, OWL 2.5

Borland C++ 5.0 - (1996, Windows 95) Released in March 1996. Works on Windows 95 and Windows NT 3.51. It does not (officially) work on Windows NT 4.0 (which was still in development at that time). 3rd party tests exhibited some problems on NT 4.0. It does not work in Windows 3.x or DOS. Despite that, it can produce either Win32, Win16 or DOS programs.

Borland C++ 5.02 - (1997) Final release of the Borland C++ IDE (subsequently replaced up by the C++Builder series), final release to support compilation to (real-mode) MS-DOS target. Windows NT 4.0 officially supported.
Last edited by jbennet; Oct 3rd, 2009 at 11:11 pm.
Moderator
Featured Poster
Reputation Points: 1764
Solved Threads: 574
Moderator
jbennet is offline Offline
16,485 posts
since Apr 2005
Nov 2nd, 2009
0
Re: BGI graphics not supported in windows..
Quote ...
BGI graphics was designed for earlier Borland compilers and won't work with 5.0+. So you have to rewrite the output portions of the program to remove the screen manipulation. Or you can find a graphics package you like and rewrite the output sections.
Click to Expand / Collapse  Quote originally posted by jbennet ...
Yes. You are using a 15 year old compiler! That compiler doesnt support windows NT.
Hmmm... So BGI graphics is not meant for this version of the compiler.

I guess that pretty much clears the issue for me now.. though I abandoned my attempts looooooooooong time back...

and to the others who replied earlier, SO SORRY for not noticing your replies back then, I am not sure why I didn't check up on this thread at all. sorry again!!
Last edited by akmaahamed_2005; Nov 2nd, 2009 at 6:44 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
akmaahamed_2005 is offline Offline
27 posts
since Apr 2007
Sep 21st, 2010
-1
Re: BGI graphics not supported in windows..
if ur problm has been solved.. can u let me kno how u solvd it?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
solitude_spark is offline Offline
7 posts
since Jan 2010
Nov 4th, 2010
0
Re: BGI graphics not supported in windows..
I am a student. I install Turbo c++ 4.5 in my pc. But this does not have BGI folder
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Farmani mehsud is offline Offline
1 posts
since Nov 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Contructor and Destructor function
Next Thread in C++ Forum Timeline: What is Function Overloading ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC