Now come on, Tater, you're making fun of me.
Type: Posts; User: Richardcavell
Now come on, Tater, you're making fun of me.
You sure? I think safeprint is safe for strings that include %s.
Richard
Won't it choke if you do:
safeprintf ( __FILE__ , __LINE__ , "I am now 25% better at programming C." ) ;
owing to the % in the string?
Behold my masterpiece. safeprint () is a special case when there's just a string. safeprintf () works the same as printf ().
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
...
Now, as to the variadic function question,
It doesn't seem possible to do something like:
int safeprint ( char* string , ... )
{
printf ( string , ... )
}
If ErrorMessage() fails, it returns -1. My program gracefully shuts down, letting go of all resources it's borrowed so far.
Mate, I know I'm over the top. Maybe it's obsessive-compulsive disorder. If there's a potential error that goes unchecked I can't concentrate on anything else until it's checked.
I'd like to...
Hi everyone. I'm trying to create a function called 'safeprint' which will always check whether the string to be printed actually made it out to the screen. It should be called like this:
int...