home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 21319 < prev    next >
Encoding:
Text File  |  1993-01-12  |  1.8 KB  |  53 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!dtint!tom
  3. From: tom@dtint.uucp (Thomas R. Kimpton)
  4. Subject: Re: Think C bug? [sprintf]
  5. Message-ID: <1993Jan12.185243.4425@dtint.uucp>
  6. Organization: Digital Technology, International
  7. References: <kevin.726748544@crash.cts.com> <1993Jan11.194525.18175@afterlife.ncsc.mil> <1993Jan11.220617.26532@kth.se>
  8. Date: Tue, 12 Jan 93 18:52:43 GMT
  9. Lines: 42
  10.  
  11. In article <1993Jan11.220617.26532@kth.se> d88-jwa@byse.nada.kth.se (Jon WΣtte) writes:
  12. >In <1993Jan11.194525.18175@afterlife.ncsc.mil> mssmith@afterlife.ncsc.mil (M. Scott Smith) writes:
  13. >
  14. >>It sounds like some people have had no problems with sprintf, while others
  15. >>have.  I wasn't sure if it was commonly used by Mac C programmers; are there
  16. >>Toolbox calls (non-ANSI) that Mac pros tend to use instead?
  17. >
  18. [deleted]
  19. >
  20. >>Is sprintf the best way to capture the functionality of Pascal's concat?
  21. >
  22. >Definately not;
  23. >
  24. >1) sprintf can't handle pascal-style strings (content, not type)
  25. I'm not sure what you mean by this.  You can pass pascal strings
  26. to sprintf and use the format '%#s' (%P in MPW).  If you mean
  27. create pascal strings, here is what I do:
  28. {
  29. char pstring[257];    /* Add one for a max size pascal string, for
  30.              * the trailing null.
  31.              */
  32.     pstring[0] = sprintf(&pstring[1],"...",...);
  33. }
  34. >2) if you use C strings, use strcat.
  35. >3) if you use pascal strings, use ConcatPStrings, which I think
  36. >   is in the file TBUtils.h or something similar.
  37. >
  38. >Cheers,
  39. >
  40. >                            / h+
  41. >-- 
  42. > -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  43. >   This signature is kept shorter than 4 lines in the interests of UseNet
  44. >   S/N ratio.
  45.  
  46. Tom.
  47.  
  48. -- 
  49. ---
  50. Tom Kimpton                            tom@dtint.dtint.com
  51. Digital Technology Int.                (801)226-2984    
  52. 500 W. 1200 South, Orem UT, 84057      FAX (801) 226-8438
  53.