Showing posts from November, 2009

A little research always worth it...

So often, a little research in software is all it takes to find that nice premade functiont that solves much of what you want to do.  I would like to say lazy programming is good programming.  But it's not laziness.  It's knowing that code that is written and tested is better than new code you will write.

Sometimes when you find that rare function, it just makes you day.  My first Eureka moment came early on in my career during one of my coop terms.  I was working on some old code that had a lot of sprintf.  I had to do some wrapping around it, and I couldn't figure out how to wrap the sprintf function.

sprintf(buffer "X has a value of %d and Y has a value of %X\n, x,y);
The declaration of sprintf is:
int sprintf ( char * str, const char * format, ... );Notice the ..., as a variable parameter list. So I made my wrapper function:MySprintf(char * buffer, const char * format, ...){}But how do I call sprintf given the variable parameter list.The answer: a function called…