beautypg.com

Strcpy, Strcspn, Strcpy strcspn – Zilog EZ80F916 User Manual

Page 386

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

366

Example

char s1[]="Production";
char s2[]="Programming";
int res;
res=strcmp(s1,s2);

strcpy

Copies the string pointed to by s2 (including the terminating null character) into the array
pointed to by s1. If copying takes place between objects that overlap, the behavior is unde-
fined.

Synopsis

#include
char *strcpy(char *s1, char *s2);

Returns

The value of s1.

Example

char s1[80], *s2;
s2=strcpy(s1,"Production");

strcspn

Computes the length of the initial segment of the string pointed to by s1 that consists
entirely of characters not from the string pointed to by s2. The terminating null character is
not considered part of s2.

Synopsis

#include
size_t strcspn(char *s1, char *s2);

Returns

The length of the segment.

Example

size_t pos;
char s1[]="xyzabc";
char s2[]="abc";
pos=strcspn(s1,s2);

This manual is related to the following products: