home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / os2 / programm / 4227 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  1.7 KB

  1. Path: sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
  2. From: dic5340@hertz.njit.edu (David Charlap)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: Bug in GCC / OS 2 ??
  5. Keywords: GCC
  6. Message-ID: <1992Aug14.192907.4897@njitgw.njit.edu>
  7. Date: 14 Aug 92 19:29:07 GMT
  8. References: <1992Aug13.094911.49327@news.th-darmstadt.de>
  9. Sender: news@njit.edu
  10. Organization: New Jersey Institute of Technology, Newark, N.J.
  11. Lines: 37
  12. Nntp-Posting-Host: hertz.njit.edu
  13.  
  14. In article <1992Aug13.094911.49327@news.th-darmstadt.de> rb532@rbhp17.rbg.informatik.th-darmstadt.de writes:
  15. >include <stdio>;
  16. >
  17. >main()
  18. >{char c
  19. >
  20. >  printf("begin of program");
  21. >  do { c = getchar ();
  22. >    printf("%d",c)}
  23. >   while (c != "X");
  24. >  printf("End");
  25. >}
  26. >
  27. >(perhaps ther are some syntax Errors now, but this doesn't matter)
  28. >I compile this program with GCC 2.1.
  29. >The result is an executable file.
  30. >I run it, and it asks for input, until I press X, and then prints 
  31. >"begin of program", then prints the digits, and then prints the "end"
  32. >why is this disorder ?
  33.  
  34. Your output in stdout is being buffered.  Use the setvbuf() function
  35. to set the stdout stream to unbuffered or to line-buffered.
  36.  
  37. >The second is that the getch() is not in the library (I get an Error 
  38. >when I compile.
  39.  
  40. getch() is not ANSI.  According to the Unix man page here, it's a
  41. <curses.h> function.  Curses hasn't been ported to OS/2.  In the DOS
  42. world, it's a common language extension.
  43.  
  44. GCC only supports ANSI functions, and a limited subset of Unix
  45. functions.
  46. -- 
  47.    |)  David Charlap           "I don't even represent myself
  48.   /|_  dic5340@hertz.njit.edu   sometimes so NJIT is right out!.
  49.  ((|,)
  50.   ~|~  Hi! I am a .signature virus, copy me into your .signature file.
  51.