[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


strncat

Append a specified number of characters to a character array.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <string.h>
char *strncat(char *dest, 
   const char *source, size_t n);
Parameters:

Parameters for this facility are:

dest  
char *  
The destination string  
source  
const char *  
The source to append  
n  
size_t  
The maximum length to append  

Remarks:

The strncat() function appends a maximum of n characters from the character array pointed to by source to the character array pointed to by dest. The dest argument must point to a null terminated character array. The source argument does not necessarily have to point to a null terminated character array.

If a null character is reached in source before n characters have been appended, strncat() stops.

When done, strncat() terminates dest with a null character ('\0').

Return:

strncat() returns the value of dest.

See Also:

"strcat"

Example of strncat() usage.:
#include <string.h>
#include <stdio.h>

int main(void)
{
	static char s1[100] = "abcdefghijklmnopqrstuv";
	static char s2[] = "wxyz0123456789";

	strncat(s1, s2, 4);
	puts(s1);

	return 0;
}

Output:
abcdefghijklmnopqrstuvwxyz


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000