Use strncpyWithEOS from Newport's Socket.cpp

This commit is contained in:
MarkRivers
2006-05-12 15:17:02 +00:00
parent 8f5d787893
commit a79a81fba5
+11 -9
View File
@@ -253,15 +253,17 @@ char * GetError(int SocketIndex)
return socketStructs[SocketIndex].errorString;
}
/***************************************************************************************/
void strncpyWithEOS(char * szStringOut, const char * szStringIn, int nNumberOfCharToCopy, int nStringOutSize)
{
char *eos = "\n";
/*
if ((nNumberOfCharToCopy + (int)strlen(eos)) > nStringOutSize) {
return;
}
*/
strncpy(szStringOut, szStringIn, nStringOutSize);
/* strcat(szStringOut, eos); */
if (nNumberOfCharToCopy < nStringOutSize)
{
strncpy (szStringOut, szStringIn, nNumberOfCharToCopy);
szStringOut[nNumberOfCharToCopy] = '\0';
}
else
{
strncpy (szStringOut, szStringIn, nStringOutSize - 1);
szStringOut[nStringOutSize - 1] = '\0';
}
}