最近在做棋牌游戏开发,把项目中经常用到的一些函数记录下来。后面会花点时间具体介绍下这些函数的原型以及使用,先做个大概记录。
1.memset()
函数原型:void * memset( void * ptr, int value, size_t num );
/*
*char *memset(dst, val, count) - sets “count” bytes at “dst” to “val”
*
*Purpose:
* Sets the first “count” bytes of the memory starting
* at “dst” to the character value “val”.
*
*Entry:
* void *dst - pointer to memory to fill with val
* int val - value to put in dst bytes
* size_t count - number of bytes of dst to fill
*
*Exit:
* returns dst, with filled bytes
*
*Exceptions:
*
*********************************************************************/
void * __cdecl memset (void *dst,int val,size_t count)
{
void *start = dst;
#if defined (_M_IA64) || defined (_M_AMD64)
{
__declspec(dllimport)
void RtlFillMemory( void *, size_t count, char );
RtlFillMemory( dst, count, (char)val );
}
#else /* defined (_M_IA64) || defined (_M_AMD64) */
while (count--) {
*(char *)dst = (<