Xref: utzoo comp.lang.c:21537 comp.windows.x:13146 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!unmvax!pprg.unm.edu!topgun.dspo.gov!lanl!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c,comp.windows.x Subject: Re: varargs and X Keywords: varargs, Motif, X Windows, error handling, dialogs Message-ID: <10958@smoke.BRL.MIL> Date: 7 Sep 89 04:11:41 GMT References: <19199@gatech.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 29 In article <19199@gatech.edu> ken@gatech.edu (Ken Seefried III) writes: >Widget Error( parent, va_list ) > Widget parent; > va_dcl >{ >va_list vaargs; >char *fmt; > va_start( vaargs ); > fmt = va_arg( args, char * ); > vsscanf( buffer, fmt, vaargs ); >Anyone have any insight into the deep dark mysteries of varargs? Yes. There are several problems here. The first is that correct usage of varargs requires that the function definition start off like: Widget Error( va_alist ) va_dcl { va_list vaargs; Widget parent; char *fmt; va_start( vaargs ); parent = va_arg( vaargs, Widget ); fmt = va_arg( vaargs, char * ); Notice several differences, especially the use of va_alist (NOT va_list!). The second problem is that vsscanf() doesn't normally exist in C libraries. Therefore you'll have to provide one..