#include <stdio.h>
#include <string.h>
int main(void){
char str[]= "/proc/proc hello/foo 4000";
char path[256];
char pid[10];
char *p;
p=strrchr(str, ' ');
strcpy(pid, p+1);
*p='\0';
strcpy(path, str);
printf("%s\n", path);// /proc/proc hello/foo
printf("%s\n", pid);// 4000
return 0;
}
2
solved C Check duplicate string entries