Hi,
To trim the leading spaces we are using strmove. But we were advised to use strlmove instead of strmove. I have read and used strlcpy and strlcat. Whether strlmove does the similar functionality and what all are its advantages?
Edit 1: Thank you Mike B and Chris Young. This is how we use strlcpy.
size_t strlcpy(char *dst, const char *src, size_t size)
{
strncpy(dst, src, size - 1);
dst[size - 1] = '\0';
return(strlen(src));
}
So I was just thinking of using strlmove() also in the same way. I want to confirm whether any specifications is defined regarding the implementation of strlmove(). I know this is one of the best place i can ask.
Edit 2: strlmove() is implemented the same way as strlcpy() and strlcat() using memmove().
size_t strlmove(char *dst, const char *src, size_t size)
{
//Error if the size is 0
//If src length is greater than size;
// memmove(dst, src, size-1) and dst[size] = \0;
//Otherwise
// memmove(dst, src, length(src));
return source len;
}
Appreciate the help and support provided.
Thanks, Mathew Liju