DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   mixed up (http://www.daniweb.com/forums/thread158306.html)

xlx16 Nov 19th, 2008 9:48 am
mixed up
 
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).
#include <stdio.h>
#include <conio.h>
int main(){
clrscr();

 gotoxy(50,20);//one
 printf("*");

 gotoxy(0,0);//two
 printf("*");

 getch();
return 0;
}
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?

niek_e Nov 19th, 2008 10:46 am
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

Ancient Dragon Nov 20th, 2008 2:21 am
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

ajay.krish123 Nov 20th, 2008 7:30 am
Re: mixed up
 
gototxy(); function might not be defined in your header file or it might be the problem with the compiler


All times are GMT -4. The time now is 11:58 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC