| I am lead to believe that BSD versions of Unix comes with bzero, while USG
| and SYSV come with memset. Am I being lead right? I need to know to reduce
| the complexity of an #ifdef in some (ultra) portable code; I want to be able
| to say:
| #if defined(BSD)
| #define ZERO(s,n) bzero((s),(n))
| #else
| #define ZERO(s,n) memset((s), 0, (n))
| #endif
| Is this the best way to do this? Or should I just assume that everyone has
| bzero accept SYSV? Post/email is fine.
Thanks to the 100s who replied; I couldn't reply to everyone.
Most people seemed to think it was mostly OK & reliable, except that
that's not quite enough! The solution? Write my own. This is it.
Anything wrong with it? This is for writing zeros into a string.
/*
* Why don't I use memset? Err... Or is it bzero? Cos it's easier
* to write my own:
*/
static void Zero (start)
char *start;
{
char *c;
int length = strlen (start);
for (c=start; c<(start+length); c++)
thanx, Simon. *c = '\0';
___________________________________________________________________________Quote:}
Simon Marshall, Dept. of Computer Science, University of Hull, Hull HU6 7RX, UK
"``La la la la la la la la la'' means I love you."