strncpy function


strncpy copies 'n' bytes from one string to another.

Library:   string.h

Prototype: char strncpy(char s1, const char *s2, size_t n);

Syntax:	   size_t n;
	   char string1[20]="red dwarf";
	   char string2[20]=";
           strncpy(string2, string1, 4);


Notes


example program.

An alternative method using 'sprintf'...


See also:


Top Master Index Keywords Functions


Martin Leslie