www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/23/21:06:05

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: why can't printf text in graphics mode
Date: Mon, 23 Dec 1996 19:17:41 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 33
Message-ID: <32BF4B55.3D73@cs.com>
References: <59djoa$3al AT owani8 DOT cc DOT hirosaki-u DOT ac DOT jp> <32bef179 DOT 9420621 AT ursa DOT smsu DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp108.cs.com
Mime-Version: 1.0
CC: zhang AT cc DOT hirosaki-u DOT ac DOT jp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tony O'Bryan wrote:
> 
> >  Now I want to printf text in the graphics mode, but it does not work, why?
> 
> Maybe djgpp's printf() writes directly to text screen memory, which is
> at a different address than graphics memory.

printf() does not write to any kind of memory; it simply writes to the
stdout file descriptor.  DOS then determines where that file descriptor
goes.  Normally, it goes to the CON: device, which results in the text
being sent to the BIOS for display on the console screen.  Since neither
DOS nor the BIOS know or care what video mode you are in, this will not
work in graphics modes.

You may say, "But this works in Pascal!"  That's because Pascal is
designed as a beginner's programming language, and thus has lots of
little gimmicks to help you out.  Normally, the video screen and the
text screen reside in totally separate and independent areas of memory.

Each graphics package has its own functions to display text on the
graphics screen.  You will have to look up the docs for that package to
see how to do it.

BTW, the <conio.h> functions won't work either; all they do is bypass
DOS and write to video memory directly.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I      |   mailto:fighteer AT cs DOT com   |
| God's final message to His Creation: | http://www.cs.com/fighteer |
| "We apologize for the inconvenience."| Fight against proprietary  |
|                      - Douglas Adams | software - support the FSF!|
---------------------------------------------------------------------

- Raw text -


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