How can I creating a function like printf that cant take unlimited arguments. I want to make a functing called Logger_Print and have it do what printf would basically do and more. I know you need to do something with the ... inorder to make it take many arguments.
Please let me know if you know how to add the argument list for the Logger_Print to the fprintf call in the function. Thanks.
Code:
void Logger_Print(int Type, char *Text, ... /*Hopefully a list of arguments */) {
switch(Type) {
case 0:
fprintf(Logger_OutFile, "Verbose: ");
break;
case 1:
fprintf(Logger_OutFile, "Status: ");
break;
case 2:
fprintf(Logger_OutFile, "Notice: ");
break;
}
fprintf(Logger_OutFile, Text, /* The list of arguments passed to this function */);
}
Please let me know if you know how to add the argument list for the Logger_Print to the fprintf call in the function. Thanks.