Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2008 00:40:43 -0700 (PDT)
From:      Unga <unga888@yahoo.com>
To:        freebsd-questions@freebsd.org
Subject:   Variable arg function question
Message-ID:  <336540.36159.qm@web57014.mail.re3.yahoo.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?336540.36159.qm>