memset function

answerme's Avatar, Join Date: Dec 2007
Ambitious contributor
hye can anyone give me the example of memset function
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
It will have all the memory location of szPath filled with '\0'
Salem's Avatar, Join Date: Nov 2007
Ambitious contributor
> memset(szPath,'\0',MAX_PATH);
And if TCHAR isn't a char, then you'll need one of
memset(szPath,'\0',MAX_PATH * sizeof TCHAR );
memset(szPath,'\0',MAX_PATH * sizeof szPath[0] );
memset(szPath,'\0',sizeof szPath );
Focus on the bit about "all-bits-zero". In other words, don't rely on memset giving you valid floats or pointers, if you try the same approach on attempting to clear more complex data types.