delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/20/06:40:15

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: A funny thing happened!
Date: Sat, 16 Aug 1997 17:21:30 -0400
Organization: Cornell University
Lines: 60
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <33F619DA.4F12@cornell.edu>
References: <33EE4447 DOT 24E09407 AT nospam DOT net> <871305859snz AT genesis DOT demon DOT co DOT uk> <33F0D3EA DOT 528A AT cs DOT com> <871576466snz AT genesis DOT demon DOT co DOT uk>
NNTP-Posting-Host: 128
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Lawrence Kirby wrote:

> >> I have been messing around with Borland C for a while.  I wanted to 
> >> try that free 32 bit compiler DJGPP.  I finally figured out what I 
> >> had to download.  I also got RHIDE, the free IDE.  So, I wrote my 
> >> first little C in the new compiler.
> >>
> >>#include <stdio.h>
> >>#include <conio.h>
> >>#include <dos.h>
> >>
> >>main()
> >>{
> >>clrscr();
> >>printf("Hello there\n");
> >>getch();
> >>printf("See You Later!");
> >>delay(1000);
> >>}
> >>
> >>And here is the funny thing.  This program wrote nothing until I hit 
> >> a key.  It was Obviously supposed to write "Hello there" first.

i do not know what is going on there but when i compile the file i
created by cutting & pasting the code you gave using the command line

gcc ttt.c -o ttt.exe

and run ttt.exe, i get

clear screen
"Hello there"
delay
"See you later"

in _THAT_ order.

i have no idea why things were different for the original poster.

> here? A simple test for the original poster would be to see what this
> does:
> 
> #include <stdio.h>
> 
> int main(void)
> {
>     printf("Hello there\n");
> 
>     for (;;)
>         ;
> }

displays "Hello there" and hangs as expected. I would like to stress
though that I have compiled and run the code that supposedly does not
display "Hello there" until after the getch, and have seen no such
behavior. i do not know who this original poster is, but maybe the code
they posted and the one they actually compiled were different?

  -- Sinan

- Raw text -


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