Overwite the character string (arg 1) with that provided (arg 2) and optionally limit the number of bytes (arg 3)
| Return Type | Function name | Arguments |
|---|---|---|
| uint32_t | CstrOverwrite | (char*,const char*,uint32_t,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
Function body:
uint32_t CstrOverwrite (char* cpDest)const char* cpSource, uint32_t nMaxlen,
{
// Category: Text Processing
//
// Overwite the character string (arg 1) with that provided (arg 2) and optionally limit the number of bytes (arg 3)
//
// Arguments: 1) cpDest Destination string
// 2) cpSource Source string
// 3) nMaxlen Max length to copy or 0 for no whole string copy
//
// Returns: 0 If either the desination or the source are not supplied
// 0+ The number of characters overwritten
_hzfunc("CstrOverwrite_a") ;
uint32_t nCount = 0; // Byte counter
if (!cpDest) return 0;
if (!cpSource) return 0;
if (!cpSource[0]) return 0;
if (nMaxlen)
for (; *cpSource && nCount < nMaxlen ; *cpDest++ = *cpSource++, nCount++) ;
else
for (; *cpSource ; *cpDest++ = *cpSource++, nCount++) ;
return nCount ;
}