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