Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- int find_string(const char *str1, const char *str2)
- {
- int res = strstr(str1, str2) - str1;
- return res < 0 ? -1 : res;
- }
- int main() {
- const char p[] = ":Fallen!~Fallen@Xeonz.users.quakenet.org PRIVMSG #Fallen :Hello";
- char *msg;
- int pos = find_string(p, " :");
- printf("pos is: %d\n", pos);
- memcpy(msg, &p[pos], strlen(p)-pos); //this line
- printf("msg: %s\n", msg);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement