straddstr()
QNX SDP8.0C Library ReferenceAPIDeveloper
Concatenate one string on to the end of another
Synopsis:
#include <string.h>
int straddstr( const char * str, 
               int len, 
               char ** pbuf, 
               size_t * pmaxbuf );
Arguments:
- str
 - The string that you want to add to the end of another.
 - len
 - The number of characters from str that you want to add. If zero, the function adds all of str.
 - pbuf
 - The address of a pointer to the destination buffer.
 - pmaxbuf
 - A pointer to the size of the destination buffer.
 
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The straddstr() function adds str to the buffer pointed to by pbuf, respecting the maximum length indicated by pmaxbuf:
- If len is zero, straddstr() calls strlen() to determine the length of str. In this case, str must be null-terminated.
 - The straddstr() function null-terminates pbuf whenever pmaxbuf is nonzero, even if the source string isn't null-terminated (but len must be nonzero in this case).
 - If len is nonzero, null bytes in the input have no special meaning (i.e., straddstr() doesn't stop copying when it reads a null byte, but it still null-terminates pbuf).
 - If the full string can't be copied, it's truncated, but pbuf is still null-terminated.
 
The function updates *pbuf to point to the end of the string (i.e., the terminating null character) and sets *pmaxbuf to be the number of bytes left in the string, including the terminating null character.
Returns:
The value of len if it's nonzero; otherwise, 
the length of str (i.e., strlen(str)).
Classification:
| Safety: | |
|---|---|
| Cancellation point | No | 
| Signal handler | Yes | 
| Thread | Yes | 
Page updated: 
