www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/26/04:00:40

From: Leon Heller <leon AT lfheller DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: printf/getch problem
Date: Mon, 26 Jan 1998 08:53:15 +0000
Organization: at home
Distribution: world
Message-ID: <jBc8WuA77Ez0EwUq@lfheller.demon.co.uk>
References: <34cc2c99 DOT 1842074 AT news DOT telusplanet DOT net>
NNTP-Posting-Host: lfheller.demon.co.uk
MIME-Version: 1.0
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34cc2c99 DOT 1842074 AT news DOT telusplanet DOT net>, tg
<tgamblin AT telusplanet DOT net> writes
>   Whenever I have a  printf before a getch, it waits until a key is
>pressed before printing the string. However, if the string ends with a
>\n it works fine. 
>
>e.g  printf("blah");
>        getch();
>
>will wait for a key to be pressed and then print "blah". If I replace
>it with "blah\n" it works.
> 
>  Is this supposed to happen and if so how do I get around it? I've
>tried the same thing with a borland compiler and it works as expected.
>

Try fflush(stdout).

Leon
-- 
Leon Heller: leon AT lfheller DOT demon DOT co DOT uk http://www.lfheller.demon.co.uk
Amateur Radio Callsign G1HSM    Tel: +44 (0) 118 947 1424
See http://www.lfheller.demon.co.uk/dds.htm for details of my AD9850
DDS system. See " "/diy_dsp.htm for a simple DIY DSP ADSP-2104 system.

- Raw text -


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