Hi all,

Got a problem with variadic arguments.

I have a function thus:

void    XVLogEvent( NSString* format, ... )
{
        NSString* logString;
        
        va_list argsP;
        va_start( argsP, format );
        
        logString = [NSString stringWithFormat:format, argsP];
        
        va_end(argsP);

        XVEventLog* logger = [XVEventLog sharedEventLog];
        [logger appendLog:logString];
}


This function is invoked by a macro so I can easily deploy a special type of 
logging. The problem I have is with the line:

        logString = [NSString stringWithFormat:format, argsP];

which causes an EXC_BAD_ACCESS. Obviously I’m doing it wrong, but if I use 
NSLogv here, it works fine. How do I turn my variadic parameters into a fully 
formatted string?

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to