beautypg.com

Strncpy function – Zilog Z80380 User Manual

Page 83

background image

UM004001-COR1103

4–19

Run Time Environment

Library Functions

strncpy

FUNCTION

Header file statement:

#include

Syntax:

char *strncpy

(char *string1, const char *string2, size_t count);

The strncpy function copies count characters of string2 to string1 and return string1. If count
is less than the length of string2, a null character (‘\0’) is not appended automatically to the
copied string. If count is greater than the length of string2, the string1 result is padded with
null characters (‘\0’) up to length count.

Note that the behavior of strncpy is undefined if the address ranges of the source and destina-
tion strings overlap.

Return Value

The return values for this function are described above.

strpbrk

FUNCTION

Header file statement:

#include

Syntax

:

char *strpbrk

(const char *string1, const char *string2 );

The strpbrk function finds the first occurrence in string1 of any character from string2. The
terminating null character (‘\0’) is not included in the search.

Return Value

This function returns a pointer to the first occurrence of any character from string2 in string1.
A NULL return value indicates that the two string arguments have no characters in common.

Parameter

Description

string1

Destination string

string2

Source string

count

Number of characters copied

Parameter

Description

string1

Source string

string2

Character set