delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/09/20:16:18

From: fleischm AT cs DOT wisc DOT edu (Scott Fleischman)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: please help, wrong result from this program
Date: 9 Mar 1997 22:54:40 GMT
Organization: UW-Madison
Lines: 29
Message-ID: <5fvf3g$qka@news.doit.wisc.edu>
References: <01bc2cbc$6888c980$63708ea1 AT a>
NNTP-Posting-Host: f183-100.net.wisc.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <01bc2cbc$6888c980$63708ea1 AT a>, liausc AT pl DOT jaring DOT my says...
>
>Hi, I need help for this program. It doesn't give me the result that I
>want. I compile by typing "gcc test13.c -o test13.exe" and I run the
>program in DOS box in win95.

Because of buffered i/o you need to add

fflush(stdout);

after each printf statement if you want it to be put on the screen 
immediately like this:

#include <conio.h>
#include <stdio.h>

int main()
{
  char keyinput;
  gotoxy(2,2);
  printf("testing");
  fflush(stdout);
  gotoxy(5,15);
  printf("testing 2");
  fflush(stdout);
  while (keyinput != 13) keyinput=getch();
  return 0;
}

- Raw text -


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