home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os2 / programm / 7857 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.0 KB  |  58 lines

  1. Path: sparky!uunet!news.larc.nasa.gov!gatsibm.larc.nasa.gov!jcburt
  2. From: jcburt@gatsibm.larc.nasa.gov ()
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: Cset/2 libraries and ANSI
  5. Date: 21 Jan 1993 17:12:23 GMT
  6. Organization: NASA Langley Research Center
  7. Lines: 46
  8. Message-ID: <1jmlhnINNce9@rave.larc.nasa.gov>
  9. References: <1993Jan20.134902.1090@ludd.luth.se> <19930120.073423.677@almaden.ibm.com>
  10. NNTP-Posting-Host: gatsibm.larc.nasa.gov
  11.  
  12. In article <19930120.073423.677@almaden.ibm.com> dmm@vnet.ibm.com (Dave Mooney) writes:
  13. >In <1993Jan20.134902.1090@ludd.luth.se> Bjorn Fahller writes:
  14. >>                 Lookup sprintf in the doc's just to find that contrary
  15. >> to anything else I've ever seen, it returns an integer telling how many
  16. >> characters was put into the buffer, instead of the pointer to it.
  17. >> Why is this? Or is it so that all other libraries I've seen are not
  18. >> ANSI conformant, and that what I've always thought to be ANSI isn't?
  19. >> What more such surprices are there?
  20. >
  21. >sprintf() has returned an integer ever since the earth cooled.  You are
  22. >perhaps confusing it with the strxxx() routines, which often return a
  23. >pointer to the string they have just manipulated?  In order to avoid
  24. >surprises like this, I recommend that you always include prototypes for
  25. >the functions you are using (by #include-ing the appropriate headers)
  26. >and compiling with -Kb.
  27. >
  28. >dave
  29. >
  30. Dave, 
  31.  Perhaps in your world sprintf() returns an integer, but on the SUN
  32. things are a bit different...and I quote (from SUN man page)
  33.  
  34. PRINTF(3S)           STANDARD I/O FUNCTIONS            PRINTF(3S)
  35.  
  36. NAME
  37.      printf, fprintf, sprintf - formatted output conversion
  38.  
  39. SYNOPSIS
  40.      #include <stdio.h>
  41.      int printf(format [ , arg ] ... )
  42.      char *format;
  43.  
  44.      int fprintf(stream, format [ , arg ] ... )
  45.      FILE *stream;
  46.      char *format;
  47.  
  48.      char *sprintf(s, format [ , arg ] ... )
  49.      char *s, *format;
  50.  
  51. hmmm...seems like sprintf returns a character pointer just like the
  52. original poster was saying...and people wonder why porting software
  53. is such a *fun* task...:-)
  54.  
  55. John
  56.  
  57.  
  58.