Date: Thu, 11 May 1995 16:28:59 +0200 From: S DOT B DOT M DOT Verstege AT research DOT ptt DOT nl (Stefan Verstege) Subject: variable arguments to function To: djgpp AT sun DOT soe DOT clarkson DOT edu Hai, If have written a function that must accept variable arguments. The first argument will be the ammount of arguments given to the function. All the arguments after this integer value, will be chars (or strings). When i do the following, the compiler won't accept the char type in the va_arg macro (i know this not allowed).. struct texts temp; va_list args; int count; char what_part; va_start( args, no_args ); /* start up */ what_part = va_arg( args, char ); /* get what to do */ for( count = 1; count < no_args; ++count ) { switch( atoi( what_part ) ) { case 102 : temp.f[count] = va_arg( args, char ); break; case 116 : temp.t[count] = va_arg( args, char ); break; } } va_end( args ); return temp ; } Does somebody know a tric, so this IS possible... I realy need to give a different amount of arguments to this function. Thanx, --Stefan ___ ___ __ __ .-|World Wide Tape Swapping|=--..-- Stefan Verstege --. / _ |/ __|\ \/ / | _____4 more information_____ ||HHS crew <-> NL Raves| | |/ |__ | > < | http: //www.xs4all.nl/~hhs ||---> gsX distro <---| \_/ |___/ /_/\_\ | ___email: hhs AT xs4all DOT nl_____ || student informatica | |___/ Global Sound `------------------------------'`---------------------' X-change Please use: S DOT B DOT M DOT Verstege AT research DOT ptt DOT nl