Now, as to the variadic function question,
It doesn't seem possible to do something like:
Code:
int safeprint ( char* string , ... )
{
printf ( string , ... )
}
The only way to deal with the different possibilities is to manually step through the input string and printf each item as it comes up. This means that my safeprint function will have to be able to cope with every conceivable format specifier that printf can handle.
I think it would be easier to have different functions, like :
Code:
int safeprint ( char* string ) ;
int safeprint2s ( char* string1 , char* string2 ) ;
int safeprintui ( unsigned int i ) ;
Is that the best idea? (Other than getting treatment for OCD)