11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Library FunctionsSTRNCPYSynopsis#include char * strncpy (char * s1, const char * s2, size_t n)DescriptionThis function copies a null terminated string s2 to a character array pointed to by s1. At mostn characters are copied. If string s2 is longer than n then the destination string will not be nullterminated. The destination array must be large enough to hold the entire string, including the nullterminator.Example#include #include voidmain (void){char buffer[256];char * s1, * s2;}strncpy(buffer, "Start of line", 6);s1 = buffer;s2 = " ... end of line";strcat(s1, s2);printf("Length = %d\n", strlen(buffer));printf("string = \"%s\"\n", buffer);See Alsostrcpy(), strcat(), strlen(), strcmp()211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!