Is there a C function to find the second occurrence of substring in string? -
Is there a C function to find the second occurrence of the sub-string in the string?
i.e. String - "213 file status 550 login has been rejected." 550 entry prohibition. "
Use strstr
.
int count_550s (char const * str) {char const * p = str; for integer number; for calculus = 0 ;; + + Count) {p = strstr (p, "550"); if (! P) brake; p ++;} calculation of return;}
Edit: forget "return"
Comments
Post a Comment