home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!ames!data.nas.nasa.gov!taligent!apple!mlanett
- From: mlanett@Apple.COM (Mark Lanett)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: annoying pascal strings
- Message-ID: <71149@apple.Apple.COM>
- Date: 12 Aug 92 21:49:05 GMT
- References: <1992Aug10.132907.23439@das.harvard.edu> <1992Aug11.033047.12451@ccu1.aukuni.ac.nz> <1992Aug12.164239.280@dtint.uucp> <1992Aug12.182106.6970@hobbes.kzoo.edu>
- Organization: Apple Computer Inc., Cupertino, CA
- Lines: 31
-
- k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
-
- >tom@dtint.uucp (Thomas R. Kimpton) writes:
- >>
- >>This is one of my favorite constructs on the mac:
- >>{
- >>char dstr[257];
- >> dstr[0] = sprintf(&dstr[1],"debug info");
- >> DebugStr(dstr);
- >>}
-
- >I just write: DebugStr("\pdebug info");
-
- >Does MPW not let you do the "\p"-string-prefix thing?
-
- Of course it does. The point is that sprintf is a varargs call and thus can
- produce error messages with usefull information in them.
-
- void vdebugstr(char* format,...) {
- char buff[257];
- va_list arglist;
- vs_start(arglist,format);
- vsprintf(buff,format,arglist);
- va_end(arglist);
- DebugStr(c2pstr(buff));
- }
-
- vdebugstr("Hey, index %i is not in range 0..31",index);
- --
- Have a bajillion brilliant Jobsian lithium licks.
- Mark Lanett, NOT speaking for anyone. Personal opinion only.
-