varargs and X

Ken Seefried III ken at gatech.edu
Thu Sep 7 07:06:13 AEST 1989


---

I'm trying to build a general purpose error notification routine
for an X11/Motif application that I am writing.  I need to use
varargs to get the error messages to the routine (printf() style).

There is, however a catch.  I also need to pass the parent widget
ID to this routine.  None of the several FM's that I have give any 
clue as to how I might do this.

More or less, this is what I want to do (sans declarations, etc.):

/*--------------------------------------------------------------------------*/

Widget Error( parent, va_list )

	Widget parent;
        va_dcl

{

va_list         vaargs;
char            *fmt;
unsigned int    foo = 0; 
Arg             xmargs[ 24 ];     
XmString        msgStr_xm;
Widget          error_dialog;
char            buffer[ 1024 ];

        va_start( vaargs );
        fmt = va_arg( args, char * );
        vsscanf( buffer, fmt, vaargs );

        msgStr_xm = XmStringCreate( buffer, CS );

        XtSetArgs( xmargs[ foo ], XmNmessageString, MsgStr_xm ); foo++;

        error_dialog = XmCreateErrorDialog( parent, "Error", xmargs, foo );

	.
	.
	.

/*-------------------------------------------------------------------------*/

Anyone have any insight into the deep dark mysteries of varargs?
Any help would be greatly appreciated...


	...ken seefried iii		...!<anywhere>!gatech!ken
	   ken at gatech.edu



More information about the Comp.lang.c mailing list