NWSMCatString

Appends a specified number of characters to a string.

Syntax

  #include <smsutapi.h> 
   
  STRING NWSMCatString ( 
     STRING_BUFFER **dest, 
     void             *source, 
     INT16             srcLen);
  

Parameters

dest

(IN/OUT) Points to the string to append.

source

(IN) Points to the string to append to the end of dest.

srcLen

(IN) Specifies the length of source.

Return Values

The following table lists the return values associated with the function.

NULL

Cannot concatenate the strings.

Nonzero

The strings are concatenated and the pointer points to dest.string.

Remarks

NOTE:This function is supported only for backward compatibility, the NWSMCatGenericString function can be used instead of this, as it provides the same functionality.

To free the string, call NWSMFreeString.

If dest is NULL, NWSMCatString allocates memory for the string. If dest.string is too small to contain the concatenated strings, NWSMCatString frees the memory and allocates a new structure with more memory.

If srcLen is set to -1, NWSMCatString calculates the length of source.

See Also

NWSMCatStrings, NWSMFreeString, NWSMStr

NWSMCatString Example

  #include <smsutapi.h> 
   
  STRING     resultString; 
  STRING_BUFFER *dest = NULL; 
  char *source = “*.exe”, *destString = “/home/user/dir1”; 
  INT16 srcLen = -1; 
  UINT16 destLen; 
   
  destLen = strlen(destString); 
  dest = (STRING_BUFFER *)malloc(sizeof(STRING_BUFFER) + destLen); 
  dest->size = destLen + 1; 
  strcpy(dest->string, destString); 
   
  resultString = NWSMCatString(&dest, source, srcLen);