delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/10/01:45:41

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Printing at a specific location
Date: Thu, 09 Apr 1998 18:17:35 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 37
Message-ID: <352D48FF.286D@cs.com>
References: <352CD0A2 DOT D3D6E027 AT bellsouth DOT net>
NNTP-Posting-Host: ppp228.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Lester Davis wrote:
> 
> Is it possible to print something to a specific loaction on the screen
> in C. If I have a page of info and only want to replace one line. Basic
> has a command Locate (x,y). Is there something similar in C.

DJGPP, and most other DOS C compilers, provide a header file named
<conio.h>, which contains screen interface functions.  You can read
about the various ones that DJGPP's conio implementation has by
installing the Info reader (v2gnu/txi390b.zip) and typing "info libc
func conio".

The simplest function for moving around the screen is gotoxy(x, y); 
Note that this function treats the top left corner of the screen as {1,
1} instead of {0, 0}.  Please also note that if you try to use stdio
output functions (printf, putchar, etc) with conio functions (gotoxy,
clrscr, getch), you may not get the results you expect.  See chapter 9.4
of the DJGPP Frequently Asked Questions list to learn more.

> Also, How do you do Graphics? Is there a library available somewhere?

Graphics are always hardware and compiler-dependent.  There is no way to
succinctly describe them in a simple post.  However, DJGPP comes with
two complete graphics libraries:  GRX and Allegro.  GRX is very similar
to Borland's BGI interface, while Allegro is a powerful
professional-quality graphics/sound/game programming library.  Choose
whichever you feel most comfortable with.

hth

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Deductive logic is tautological;    |
|       aka Fighteer I       | there is no way to get a new truth   |
|   mailto:fighteer AT cs DOT com   | out of it."                          |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------

- Raw text -


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