Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!pyramid!rnovak From: rnovak@pyrnova (Robert E. Novak) Newsgroups: comp.sys.pyramid Subject: Re: Wrapper function to sprintf Message-ID: <15847@pyramid.pyramid.com> Date: 29 Feb 88 18:09:27 GMT Sender: daemon@pyramid.pyramid.com Reply-To: rnovak@pyrnova.UUCP (Robert E. Novak) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 40 Keywords: sprintf, wrapper, varargs Summary: Use VARARGS! In article <232400003@prism> atj@prism.UUCP writes: >Hi, I am having a little problem with developing a "wrapper" to sprintf. >What I wish to do is write a "dialog_box" routine that takes the >same parameters as printf. So, I have the following: >dialog_box(cs, args) >char *cs; >{ > char buffer[512]; > sprintf(buffer, cs, args); >} >/* anything obviously wrong with this? */ > >What happens is that only the first arg is formatted correctly. >This is on a Pyramid 9820, OSx 4.0 (BSD universe) >Thanks. >Alex T. Jenkins >Mirror Systems, Cambridge Massachusetts atj@mirror.TMC.COM VARARGS(3-ucb) Pyramid OSx Operating System VARARGS(3-ucb) NAME varargs - variable argument list SYNOPSIS #include function(va_alist) va_dcl va_list pvar; va_start(pvar); f = va_arg(pvar, type); va_end(pvar); DESCRIPTION This set of macros provides a means of writing portable pro- cedures that accept variable argument lists. Routines hav- ing variable argument lists (such as printf(3)) that do not use varargs are inherently nonportable, since different machines use different argument passing conventions.