i've been including stdarg.h for over a year, and using va_list, va_start(),
va_end(), etc in several PalmOS apps.  i use CWR5, and link with the "MSL
Runtime Palm OS (2i).Lib" library.

here's a snippet of code that illustrates my usage:


Boolean DbgAssert(const char *pszFile, UInt iLine, const char *pszFmt, ...)
{
    va_list   arg;
    char   sz[256];
    CharPtr   pch = sz;
    Boolean   fRet = fTrue; // set to false to prevent this assert from
firing
    int    ival;

    pch += StrPrintF(pch, "%s, li %d", pszFile, iLine);

    if (pszFmt)
        {
        *pch++ = ':';
        *pch++ = ' ';
        *pch++ = '"';

        va_start(arg, pszFmt);
        pch += StrVPrintF(pch, pszFmt, arg);
        va_end(arg);
        // Remove trailing newlines...
        while (*(pch-1) == '\n')
            --pch;

// .....





----- Original Message -----
From: "Jun-Kiat Lam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 1999 4:01 PM
Subject: Re: is there anything by which we can pass variable no of arguments
to a function


> The macro you are looking for is actually va_start(), va_arg () and va_end
> (). It's mentioned in the MSL C docs. However, you can't really use this
> macro on the Palm OS in CodeWarrior since it's implemented in <stdarg.h>,
> and as you mentioned, most of the MSL ANSI C libs are not supported on the
> Palm OS. I don't know if something equivalent is implemented in the Palm
OS
> SDK, but I doubt it. Sorry.
>
> Jun-Kiat Lam
> Metrowerks Technical Support
>
> ----- Original Message -----
> From: Gaurav Palvia <[EMAIL PROTECTED]>
> To: palm-dev-forum <[EMAIL PROTECTED]>
> Sent: Monday, November 08, 1999 6:57 AM
> Subject: is there anything by which we can pass variable no of arguments
to
> a function
>
>
> > hi pals,
> >
> > is there anything by which we can pass variable no of arguments to a
> > function.The standard vm_list ,vm_start macros are not supported
> > in the code warrior c compiler
> >
> >
>
>

Reply via email to