🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: att.lang.c++
Article #166

Help- c programming

#166
From: slamdunk
Date: Sat, 27 Mar 1999 00:00
38 lines
1704 bytes
The problem is in the "for" loop of the CLRSCR function.  Why doesn't
it work?  Hints?

#include <stdio.h>
#include <stdlib.h>
/***********Beginning memory location of color videomemory**********/
#define VIDEOMEMORY (char far *) 0xb8000000L
#define BLACK       (char) 0

void FILLSCREEN(char c) {      // fills screen with character 'C'
	int x,y;
	for (y=1; y<=24; y++)       // for each Y-coord 1..24
		for (x=1; x<=80; x++)    // for each X-coord 1..80
			printf("%c", c);
}

void CLRSCR ( int UX,  // upper left X-coord
	            int UY,  // upper left Y-coord
	            int LX,  // lower right X-coord
	            int LY)  // lower right Y-coord
	 {
	            char far *c;  // pointer into videomemory
		  int y,        // outer loop counter
		      x;        // inner loop couter


		for (y=UY; *(c + y) < *(c + LY); y+=2)
		 {	for (x=UX; *(c + x) < *(c + LX); x+=2)
			  {	printf("%c",0); }
		  }
	  }

void main (void) {
	FILLSCREEN ('X');      // fills screen with 'X'
	CLRSCR (10,10,70,20);   // cut a hole in the middle of the

                                                       //  screen
}
Technical Details
Message-ID: <36fd5254.150669080@news.erols.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d4ba,da90caff31ed307e,start
X-Google-Attributes: gid10d4ba,public
From: slamdunk@usa.com (slamdunk)
Subject: Help- c programming
Date: 1999/03/27
Message-ID: <36fd5254.150669080@news.erols.com>
X-Deja-AN: 459818069
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@rcn.com
X-Trace: GVX66v9eEbtUfbZxC2NgwnK6Wi6uU3LAWQTqjkJLSP4D9BoMqcZsEQ==
Mime-Version: 1.0
NNTP-Posting-Date: 27 Mar 1999 22:15:47 GMT
Newsgroups: att.lang.c++