using Graphic.h

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2007
Posts: 2
Reputation: abhijit11 is an unknown quantity at this point 
Solved Threads: 0
abhijit11 abhijit11 is offline Offline
Newbie Poster

using Graphic.h

 
0
  #1
Feb 23rd, 2007
hi,

hav jsut started with learnin c++ programmin, am using the dev c++ compiler(if u knw a better one plz tell me)...i just learnt basic graphics using the library graphics.h. I hav heard its a very old library but i dont knw of any other one's, so plz guide me as to which library should i use.

i made an XnO game(without any graphics). now i want to incorporate graphics into it. Using graphics.h i created an intro screen. Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it

used :-

outtextxy(13,13,a) - but its givin the below error


invalid conversion from `char' to `char*'

how do i correct this??
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,508
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1480
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: using Graphic.h

 
0
  #2
Feb 23rd, 2007
graphics.h is a Borland-specific header file and not supported by any other compiler. When you write Windows programs you must use win32 api graphics functions, which are completly different than those you learned with graphics.h.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 327
Reputation: Colin Mac is on a distinguished road 
Solved Threads: 22
Colin Mac Colin Mac is offline Offline
Posting Whiz

Re: using Graphic.h

 
0
  #3
Feb 23rd, 2007
Originally Posted by abhijit11 View Post
hi,

Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it

used :-

I think it would be.

outtextxy(13,13,a) - but its givin the below error
I think it might be.

outtextxy(13,13,"a")

Or you can do

moveto(13,13);
outtext(a);

Also, if you plan on printing out integers in graphics mode, they need to be converted into a string
Last edited by Colin Mac; Feb 23rd, 2007 at 12:09 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,508
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1480
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: using Graphic.h

 
0
  #4
Feb 23rd, 2007
dev c++ compiler does not support any of the functions in graphics.h. You need more than just a .h file -- you will also need a *.lib library file which dev c++ does not support. So even if you get your program to compile it will not link due to lack of libraries.

If you really want to use functions in graphics.h then you have a couple options: (1) use old version of Turbo C/C++ or (2) Upgrade to newest version of Turbo C (I don't know if that version supports graphics.h or not, I doubt it because I think Borland made a 32-bit compiler out of it and graphic.h was for 16-bit MS-DOS operating system)
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: using Graphic.h

 
0
  #5
Feb 23rd, 2007
Well, Borland BGI is available till version 5 of Borland C++ Builder and available with every turbo c++(except the latest 2006 version).

BGI is crap and there is no guarantee that your current code compiles with current dev c++ compiler.

You should rather use system API and DirectX and OpenGL whiich are. I dont have much idea of all these things, but these are most popular.

If you want to use bgi, you can get turbo c++(an older version) for free from borland.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2
Reputation: abhijit11 is an unknown quantity at this point 
Solved Threads: 0
abhijit11 abhijit11 is offline Offline
Newbie Poster

Re: using Graphic.h

 
0
  #6
Feb 24th, 2007
Originally Posted by Ancient Dragon View Post
dev c++ compiler does not support any of the functions in graphics.h. You need more than just a .h file -- you will also need a *.lib library file which dev c++ does not support. So even if you get your program to compile it will not link due to lack of libraries.

If you really want to use functions in graphics.h then you have a couple options: (1) use old version of Turbo C/C++ or (2) Upgrade to newest version of Turbo C (I don't know if that version supports graphics.h or not, I doubt it because I think Borland made a 32-bit compiler out of it and graphic.h was for 16-bit MS-DOS operating system)

yes i knw tat dev c++ compiler in its basic form does not support graphics.h but they have the option where if the .h file is added and the .lib files also included graphics.h works in it...

ok...am downloading turbo c++ and shifting to it...thx
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 10
Reputation: kansmish82 is an unknown quantity at this point 
Solved Threads: 1
kansmish82's Avatar
kansmish82 kansmish82 is offline Offline
Newbie Poster

Re: using Graphic.h

 
0
  #7
Feb 24th, 2007
hey, how bout if u try to make it outtextxy(13,13,"a") instead......this function, as far as i know doesn't work without quotes.......
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,117
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 282
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: using Graphic.h

 
0
  #8
Feb 24th, 2007
Originally Posted by kansmish82 View Post
hey, how bout if u try to make it outtextxy(13,13,"a") instead......this function, as far as i know doesn't work without quotes.......
Originally Posted by Colin Mac View Post
I think it might be.
outtextxy(13,13,"a")
All you need to do is read his request:
Originally Posted by abhijit11 View Post
Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it
'a' is a variable. It contains what the user typed in. You don't use double quotes around a variable if you want to display what was entered. abhijit11 used the function correctly -- unless he defined 'a' as a single character. But we don't know that.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 327
Reputation: Colin Mac is on a distinguished road 
Solved Threads: 22
Colin Mac Colin Mac is offline Offline
Posting Whiz

Re: using Graphic.h

 
0
  #9
Feb 24th, 2007
Originally Posted by WaltP View Post
All you need to do is read his request:

'a' is a variable. It contains what the user typed in. You don't use double quotes around a variable if you want to display what was entered. abhijit11 used the function correctly -- unless he defined 'a' as a single character. But we don't know that.
Oh well, the second half of my post would have worked if the OP hadn't.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC