cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/03/23:19:14

From: lonniem AT cs DOT utexas DOT edu (Lonnie McCullough)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Simple problem regarding text on the screen
Date: Fri, 01 Aug 1997 08:44:07 GMT
Message-ID: <33e1a12d.1256028@news.nol.net>
References: <01bc9de2$4b4ae320$LocalHost AT damien>
NNTP-Posting-Host: ip38-58.nol.net
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 31 Jul 1997 18:51:46 GMT, "Richard Birch"
<richardbirch AT dial DOT pipex DOT com> wrote:

>I have a really simple, but equally annoying problem. Every time I output
>anything to the screen using cout or putch, it doesn't appear until either
>I output a new-line character or the program exits. Here's an example;
>
>#include <conio.h>
>#include <strstrea.h>
>
>main() {
>          cout << "Text";
>          getch();
>}
>
>Some programs I've done work, but I can't figure out why. Maybe I'm totally
>blind but can anyone help?
>
><richardbirch AT dial DOT pipex DOT com>
The problem is that cout, printf and similar functions buffer their
output until a newline is reached or until an input action is
requested.  Mixing cout and getch (which reads directly from the
console without worrying about the output buffers other systems like
printf and cout use) is a bad idea because it will result in what you
describe.  Use getchar (or something like that).


Lonnie McCullough
lonniem AT cs DOT utexas DOT edu

- Raw text -


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