Mail Archives: djgpp/2003/03/04/07:00:15
Graham Rounce wrote:
>
> Can anyone please tell me why textcolor isn't working, and
> ScreenGetCursor seems to return y and y instead of x and y?
>
> The prog below prints "hello" 16 times all in the same color,
> then "11 11".
>
> #include <stdio.h>
> #include <pc.h>
>
> main() {
> int i,*x,*y;
>
> for (i=0;i<16;i++) {
> textcolor(i);
> printf("\nhello");
> }
>
> ScreenSetCursor(5,11);
> ScreenGetCursor(x,y);
x and y were defined as pointers to int, but never initialized.
They are pointing at who knows what. You were just unlucky you
didn't get some sort of crash here. Assuming ScreenGetCursor
wants pointers to variables, which seems logical.
> printf("%d %d",*x,*y);
> }
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
- Raw text -