943,796 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 414
  • C RSS
Nov 19th, 2008
0

mixed up

Expand Post »
when i wrote the following program in turbo c,the out put was right but when i wroted it in
borland c,the out put was wrong and the (*) was printed in wrong place,so what is the problem with
borland c for dos.for another example i wrote a program which contained some graphical features
compilers couldent compile it ,exept borland c for dos(even borland c for windows coulden`t compile
it,an error about bgi and windows ...?! happend).
  1. #include <stdio.h>
  2. #include <conio.h>
  3. int main(){
  4. clrscr();
  5.  
  6. gotoxy(50,20);//one
  7. printf("*");
  8.  
  9. gotoxy(0,0);//two
  10. printf("*");
  11.  
  12. getch();
  13. return 0;
  14. }
by the way i have an other question:
can u please brif me on bgi api (16- bit 32- bit os) or name some good web sites about it?
Last edited by Narue; Nov 19th, 2008 at 10:23 am. Reason: added code tags, do it yourself from now on or I'll start infracting you for rule violations
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xlx16 is offline Offline
10 posts
since May 2008
Nov 19th, 2008
0

Re: mixed up

gotoxy() is a function developed by Borland for Turbo C. It was never standard C to begin with, so to get your program back to standards and up to date, try using: SetConsoleCursorPosition()
Here's another usefull link

other things that are non-standard in your program are:
#include <conio.h> Just delete it
clrscr(); Click here for alternatives
getch(); . Use getchar(); instead if you're just using it to pause the program
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Nov 20th, 2008
0

Re: mixed up

Quote ...
for another example i wrote a program which contained some graphical features
compilers couldent compile it ,exept borland c for dos(even borland c for windows coulden`t compile
As you found out the hard way, attempting to port programs written with ancient Turbo C is pretty tedious -- usually requires 100% rewrite of everything used from dos.h and graphics.h
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Nov 20th, 2008
0

Re: mixed up

gototxy(); function might not be defined in your header file or it might be the problem with the compiler
Reputation Points: 6
Solved Threads: 9
Junior Poster in Training
ajay.krish123 is offline Offline
90 posts
since Nov 2008

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: Likely questions
Next Thread in C Forum Timeline: corruption of the heap





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


Follow us on Twitter


© 2011 DaniWeb® LLC