 | C166 User's Guide |  |
|
|
| xstrncpy| Summary |
#include <string.h>
char xhuge *xstrncpy (
char xhuge *dst, /* destination string */
const char xhuge *src, /* source string */
int len); /* max characters to copy */
| | Description | The xstrncpy function copies at most len characters from src to dst. Characters are copied until a null character ('\0') is copied or until len characters have been copied. If the length of src is less than len the remaining bytes in dst are padded with null characters ('\0'). Note - This function uses xhuge pointers to objects and may be used in any memory model other than Tiny Model.
| | Return Value | The xstrncpy function returns dst. | | See Also | xstrcmp, xstrcpy, xstrlen | | Example |
#include <string.h>
#include <stdio.h> /* for printf */
void tst_strncpy (char xhuge *s) {
char buf [21];
xstrncpy (buf, s, sizeof (buf));
buf [sizeof (buf)-1] = '\0';
}
|
|
|