User Tools

Site Tools


c:string.h:strstr
click
to support this page (eg 0,42 € or so) Thanks.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:string.h:strstr [2012/07/16 22:41]
127.0.0.1 external edit
c:string.h:strstr [2013/02/17 02:32] (current)
Daniel Gohlke
Line 1: Line 1:
-    char *strstr(const char *str1, const char *str2);+{{keywords>wiki library source code example reference}} 
 +====== strstr ====== 
 + 
 +<code c> 
 +#include <stdlib.h> 
 +char *strstr(const char *str1, const char *str2); 
 +</code> 
 + 
 + 
 +=====  strstr C Sourcecode Example ===== 
 +<code c> 
 +/*  
 + * strstr example code 
 + * http://code-reference.com/c/string.h/strstr 
 + */ 
 +#include <stdio.h> 
 +#include <string.h> 
 +     
 +int main ( void ) 
 +
 +   char str[] = "42 is the result or ? but what was the question"; 
 +   char *ptr; 
 +   // set the Pointer ptr to "or ?" 
 +   ptr = strstr (str, "or ?"); 
 +   // replace the text with "yes" 
 +   strncpy (ptr, "yes", 3); 
 +   printf("%s\n",str); 
 +   return 0; 
 +
 + 
 + 
 +</code> 
 + 
 +==== output of strstr c example ==== 
 +    42 is the result yes? but what was the question 
 +    
advertising
c/string.h/strstr.txt · Last modified: 2013/02/17 02:32 by Daniel Gohlke

Impressum