delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/03/04/07:00:15

Message-ID: <3E64909B.51795538@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with textcolor and ScreenGetCursor?
References: <b41s53$1al$1 AT newsg2 DOT svr DOT pol DOT co DOT uk>
Lines: 35
Date: Tue, 04 Mar 2003 11:47:25 GMT
NNTP-Posting-Host: 12.90.169.144
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1046778445 12.90.169.144 (Tue, 04 Mar 2003 11:47:25 GMT)
NNTP-Posting-Date: Tue, 04 Mar 2003 11:47:25 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019