home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5005 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.crosslink.net!usenet
  2. From: vicky@steeds.com (Vicky Staubly)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: simple K&R ANSI-C examples won't compile under SAS/C
  5. Date: 7 Mar 1996 03:58:03 GMT
  6. Organization: CrossLink Internet Services
  7. Message-ID: <4hlmsb$eod@zeus.crosslink.net>
  8. References: <68771782@0humpty.tomate.tng.oche.de>
  9. NNTP-Posting-Host: shire.steeds.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-NewsSoftware: GRn 2.1 Feb 19, 1994
  14.  
  15.  
  16. In article <68771782@0humpty.tomate.tng.oche.de> humpty@TOMATE.TNG.OCHE.DE (Andreas Mixich) writes:
  17. > this little example form the 'Kernighan&Ritchie' won't compile:
  18. > #include <stdio.h>
  19. > #include <clib/alib_stdio_protos.h>
  20. > main()
  21. > {
  22. >     int c;
  23. >      while((c = GetChar()) !=EOF)
  24. >     PutChar(c);
  25. > }
  26.  
  27. Well, a couple things. First, you should be using "getchar()"
  28. and "putchar()" not "GetChar()" and "PutChar()". Yes, case
  29. matters.
  30.  
  31. Secondly, stdio.h and clib/alib_stdio_protos.h define
  32. different versions of the same routines. stdlib.h defines
  33. the versions included by SAS in their c.lib... And
  34. clib/alib_stdio_protos.h defines the versions provided
  35. with the Amiga in amiga.lib... I usually use the SAS
  36. routines, especially for non-Amiga specific development
  37. (i.e. very portable software).
  38.  
  39. So, change the routine names to lower case, and pick
  40. one of the include files, and try it then. Good luck!
  41.  
  42.                     Vicky
  43.  
  44. --
  45. Vicky Staubly        Amiga 3000 owner    vicky@steeds.com
  46. -- 
  47. "Software isn't released, it's allowed to escape."
  48.