Article View: comp.os.msdos.programmer
Article #7847Re: Writing to screen, no cursor movement
From: Anton Maurovic
Date: Sun, 08 Oct 1995 12:55
Date: Sun, 08 Oct 1995 12:55
53 lines
2259 bytes
2259 bytes
wcw@wolfenet.com (William White) wrote:
> I'm programming in text mode, and would like to know how to write characters
>to the screen without moving the cursor. Just backing up the cursor one
>column after a character is written is not good enough.
> Here is what I need this for:
>
> I'm trying to write a program that does all screen I/O without the screen
>borders scrolling. I need to be able to write in column 80 on line 25
>without the cursor going to the next line, thus making line 1 disappear off
>the screen.
>
Hi Will.
If you could let me know what language you're programming in, I could probably provide
you with more help. Otherwise I'll assume you're programming in C. In C/C++, you can
use the gotoxy() function to specify where you wish to relocate the cursor to, and
this allows you to put it on line 25 without scrolling the screen. Here is an example:
<- Cut here ->
/*
* A *VERY* simple program for placing text at the top and bottom of the screen.
* By Anton Maurovic, SYSLYNC Computing.
* syslync@dove.mtx.net.au
*
* Of couse, this code is NOT copywrite.
*
*/
#include <stdio.h>
void main(void)
{
gotoxy(1,25); //Relocate cursor on bottom of screen (line 25), against
//the left-hand side of the screen.
printf("This should be at the bottom of the screen");
gotoxy(1,1); //Relocate cursor in the top corner of the screen.
printf("This should be at the top of the screen");
}
<- Cut here ->
I hope this is what you wanted to know. If not, please e-mail me.
Yours sincerely,
Anton Maurovic.
syslync@dove.mtx.net.au
Technical Details
Message-ID:
<458hns$mfp@oznet07.ozemail.com.au>Path:
arc1-ca.pugleaf.net!news.cs.su.oz.au!metro!OzEmail!usenetReferences:
<44rvl0$3pq@news1.wolfe.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.cs.su.oz.au!metro!OzEmail!usenet From: Anton Maurovic <syslync@dove.mtx.net.au> Newsgroups: comp.os.msdos.programmer,comp.lang.c,comp.lang.c++ Subject: Re: Writing to screen, no cursor movement Date: 8 Oct 1995 12:55:24 GMT Organization: SYSLYNC Computing Message-ID: <458hns$mfp@oznet07.ozemail.com.au> References: <44rvl0$3pq@news1.wolfe.net> NNTP-Posting-Host: sladl1p29.ozemail.com.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.2b5 (Windows; I; 16bit) To: wcw@wolfenet.com