why can't I do :
strncpy (str2,NULL,5);
why can't I do :
strncpy (str2,NULL,5);
so what do I do to assign str2 to NULL?
or if the string contains something sensitive like passwords, and you want to be extra secure, you can wipe the whole string like this:
Of course sizeof will only work if str2 is an array; if it's a pointer you need to know the actual size...Code:memset( str2, '\0', sizeof( str2 ) );
In most cases though, I'd just set the first character to NUL like Elysia showed.
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010