delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/29/00:15:51

From: Alexander Lehmann <lehmann AT mathematik DOT th-darmstadt DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ghosts in DJGPP :-)
Date: 28 Jan 1997 23:12:11 GMT
Organization: Technische Hochschule Darmstadt
Lines: 39
Message-ID: <5cm14b$19uk@rs18.hrz.th-darmstadt.de>
References: <32ED747F DOT 70BD AT fi DOT muni DOT cz>
NNTP-Posting-Host: fb0408.mathematik.th-darmstadt.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

xlysak <xlysak AT fi DOT muni DOT cz> wrote:
: Can someone help me ? 

: In my program are two function - first is printf() and second is
: getch(), 
: but - first is called getch() and then printf(). Ghosts in the GCC :-)? 
: All examples showed bellow running correctly in Borland C++ 3.1.

: Thanks for all answers !
:                                Marian (xlysak AT informatics DOT muni DOT cz)

: example --->

: void main()
: {
:    int ch;

:    printf("Hi , ");
:    ch = getch();
: }

: Output is (!) :
:   (1) - wait for getch()
:   (2) - Hi ,

You get problems when mixing stdio (buffered) and console io
functions, to fix this, you should call fflush(stdout) before
switching to c??? functions. Otherwise the output in flushed at the
end of the program (or if you write a newline), which mixes
everything.


bye, Alexander

-- 
Alexander Lehmann, alex AT hal DOT rhein-main DOT de        |  "On the Internet,
lehmann AT mathematik DOT th-darmstadt DOT de               |   nobody knows
lehmann AT usa DOT net (permanent forward)              |   you're a dog."
<url:http://home.pages.de/~lehmann/>

- Raw text -


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