Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!EB.se!kenneth From: kenneth@EB.se (Kenneth Persson) Newsgroups: comp.sys.next Subject: Re: methods with arbitrary # of args? How? Keywords: varargs Message-ID: Date: 19 Oct 90 12:46:30 GMT References: <3860@network.ucsd.edu> Sender: news@EB.se (EB Signal News server) Organization: EB Signal AB, Stockholm, Sweden Lines: 43 Look for the file mivarargs.h and for examples look at the |error:| method in the class Object: // // Generate an error diagnostic using aCStr in the style of printf // followed by a variable number of argument, e.g.: // // return [self error:"index %d exceeds limit %d", index, limit]; // - error: (STR) aCStr, ... { va_list ap; va_start(ap); return (*_error)(self, aCStr, ap); va_end(ap); } or at the |sprintf:| method in the class String: // // Create a new instance and assign string // from the format and args. // + sprintf:(STR)fmt, ... { char buf[BUFSIZ]; va_list ap; va_start(ap); vsprintf(buf, fmt, ap); va_end(ap); return [self str: buf]; } p.s Can somebody out there reply to me if this message has reached you? I'm not sure our postings are spread. -- +-------------------------+--------------------------+ | Kenneth Persson | email: kenneth@eb.se | | EB Signal AB, Sweden | voice: +46 8 726 2267 | +-------------------------+--------------------------+