Variable arg function question

Unga unga888 at yahoo.com
Sun May 4 07:40:44 UTC 2008


Hi all

I need to implement a variable argument function in C.
The number of args are not known but the type is
known, all are strings.

Unfortunately va_arg() [stdarg(3)] does not return
NULL or any other suitable value after processing the
arg list, it just simply crashes once the arg list is
exhausted.

It seems there is no way to know the number of args
inside the called function.

How do you guys implement variable arg function such
as f(str1, str2, str3, ..., strN)?

Sorry for the sightly off topic question, the only
relevance is I'm programming this app on FreeBSD 7.0
:)

Many thanks in advance.

Kind regards
Unga




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the freebsd-questions mailing list