strncpy(D3) strncpy(D3)
NAME
strncpy - copy a string using a specified number of characters
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
char *strncpy (char *sptr1, const char *sptr2, size_t nchr)
Arguments
The arguments sptr1 and sptr2 each point to strings, and each
string is an array of characters terminated by a null-
character unless the length of sptr2 is nchr or more.
DESCRIPTION
The function strncpy copies at most nchr characters from the
string pointed to by sptr2 into the string pointed to by
sptr1. If a null-character is reached in sptr2 before nchr
characters have been copied, strncpy fills in the rest of the
nchr characters of sptr1 with null-characters. The result is
not null-terminated if the length of sptr2 is nchr or more.
The function strncpy alters sptr1 without checking for
overflow of the array pointed to by sptr1. If copying takes
place between strings that overlap, the behavior is undefined.
Return Values
The function strcmp returns the value of sptr1, which points
to a string of nchr characters in length.
USAGE
Character movement is performed differently in different
implementations; thus, overlapping moves may yield surprises.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
REFERENCES
bcmp(D3), bcopy(D3), strcpy(D3), strlen(D3)
Copyright 1994 Novell, Inc. Page 1
strncpy(D3) strncpy(D3)
NOTICES
Portability
All processors
Applicability
ddi: 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2