🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #834

Re: Bug in GCC / OS 2 ??

#834
From: David Charlap
Date: Fri, 14 Aug 1992 19:29
37 lines
1770 bytes
In article <1992Aug13.094911.49327@news.th-darmstadt.de> rb532@rbhp17.rbg.informatik.th-darmstadt.de writes:
>include <stdio>;
>
>main()
>{char c
>
>  printf("begin of program");
>  do { c = getchar ();
>	printf("%d",c)}
>   while (c != "X");
>  printf("End");
>}
>
>(perhaps ther are some syntax Errors now, but this doesn't matter)
>I compile this program with GCC 2.1.
>The result is an executable file.
>I run it, and it asks for input, until I press X, and then prints 
>"begin of program", then prints the digits, and then prints the "end"
>why is this disorder ?

Your output in stdout is being buffered.  Use the setvbuf() function
to set the stdout stream to unbuffered or to line-buffered.

>The second is that the getch() is not in the library (I get an Error 
>when I compile.

getch() is not ANSI.  According to the Unix man page here, it's a
<curses.h> function.  Curses hasn't been ported to OS/2.  In the DOS
world, it's a common language extension.

GCC only supports ANSI functions, and a limited subset of Unix
functions.
-- 
   |)  David Charlap           "I don't even represent myself
  /|_  dic5340@hertz.njit.edu   sometimes so NJIT is right out!.
 ((|,)
  ~|~  Hi! I am a .signature virus, copy me into your .signature file.
Technical Details
Message-ID: <1992Aug14.192907.4897@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
References: <1992Aug13.094911.49327@news.th-darmstadt.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.os2.programmer
Subject: Re: Bug in GCC / OS 2 ??
Keywords: GCC
Message-ID: <1992Aug14.192907.4897@njitgw.njit.edu>
Date: 14 Aug 92 19:29:07 GMT
References: <1992Aug13.094911.49327@news.th-darmstadt.de>
Sender: news@njit.edu
Organization: New Jersey Institute of Technology, Newark, N.J.
Lines: 37
Nntp-Posting-Host: hertz.njit.edu