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:



Martin Leslie

AltStyle によって変換されたページ (->オリジナル) /