Return to Snippet

Revision: 62199
at February 7, 2013 05:15 by ibob


Initial Code
//this is the way of passing multiple params
	+(NSInteger) writeWithFormat: (NSString*) formatString, ... {
		va_list va; //this will contain the list of parameters
		NSInteger length;
		//get all args, but last writen arg thats formatString.
		va_start(va, formatString); 
		//string with format plus all arguments
		NSString* str =[ [ NSString alloc ] initWithFormat:formatString arguments:va ]; 
		va_end(va); //finish the parsing of arguments
		printf("%s\n",[ str UTF8String ]); //output to the console
		length = [ str length ]; //know the lenght of the string in characters
		[ str release ]; //relase the string
		return length; //return the amount of characters writen to the console
	}

Initial URL

                                

Initial Description

                                

Initial Title
Example of Unknown Multi Params Function 

Initial Tags

                                

Initial Language
Objective C