30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

printf("\n");<br />

printf("memset(\"%s\", \'%c\',10);\n", buf2, ch2);<br />

memset(buf2, ch2, 10);<br />

printf("buf2 aftermemset: %s\n", buf2);<br />

}<br />

Output:<br />

memset("What time isit?", '?',4);<br />

buf1 after memset: ???? time is it?<br />

memset("", 'y',10);<br />

buf2 after memset: yyyyyyyyyy<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 300<br />

strcat<br />

2004 Microchip Technology Inc.<br />

Description: Appends a copy of the source stringto the end of the destination<br />

string.<br />

Include: <br />

Prototype: char *strcat(char *s1, const char *s2);<br />

Arguments: s1 null terminated destination string to copy to<br />

s2 null terminated source string to be copied<br />

Return Value: Returns a pointer to the destination string.<br />

Remarks: This function appends the source string (including the terminating<br />

null<br />

character) to the end of the destination string. The initial character of<br />

the source string overwrites the null character at the end of the<br />

destination string. If the buffers overlap, the behavior is undefined.<br />

Example: #include /* for strcat, strlen */<br />

#include /* for printf */<br />

int main(void)<br />

{<br />

char buf1[50] = "We're here";<br />

char buf2[50] = "Where is the time?";<br />

printf("buf1 : %s\n", buf1);<br />

printf("\t(%d characters)\n\n", strlen(buf1));<br />

printf("buf2 : %s\n", buf2);<br />

printf("\t(%d characters)\n\n", strlen(buf2));<br />

strcat(buf1, buf2);<br />

printf("buf1 after strcat of buf2: \n\t%s\n",<br />

buf1);<br />

printf ("\ n");<br />

res = strcmp (buf1, buf3);<br />

if (res

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

Saved successfully!

Ooh no, something went wrong!