DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

udi_strcpy, udi_strncpy, udi_memcpy, udi_memmove


String/memory copy

SYNOPSIS

#include <udi.h>
char *udi_strcpy (

	char *s1,

	const char *s2 );
 
char *udi_strncpy (

	char *s1,

	const char *s2,

	udi_size_t n );
 
void *udi_memcpy (

	void *s1,

	const void *s2,

	udi_size_t n );
 
void *udi_memmove (

	void *s1,

	const void *s2,

	udi_size_t n );
 

ARGUMENTS s1 is a pointer to the destination string or memory area.

s2 is a pointer to the source string or memory area.

n is the number of bytes to copy from s2 to s1.

DESCRIPTION The udi_strcpy and udi_strncpy functions copy the character array string pointed to by s2 (including the null-terminator character) to the character array string pointed to by s1. The strings must not overlap and the destination string s1 must be large enough to receive the copy.

The udi_strncpy function will stop copying once the specified n number of bytes has been copied or when a null terminator is encountered in the s2 string, whichever comes first. If there is no null byte encountered among the first n bytes of the s2 string, the result in s1 will not be null terminated. In the case where the length of s2 is less than n, the remainder of s1 will be padded with null characters.

The udi_memcpy function will operate in the same manner as the udi_strncpy function except that null characters (`\0') will be ignored and n bytes will always be copied into the s1 string. The memory areas must not overlap.

The udi_memmove function is similar to udi_memcpy but allows overlapping regions; it operates as if the contents of the s2 area were first copied to a temporary area and then copied back to the s1 area.

RETURN VALUES These functions return a pointer to the destination string s1.


UDI Core Specification Contents