C Check duplicate string entries -


i need check if in file there duplicates entries, in c.

sample file:

/proc/proc1 1000 /proc/proc2 2000 /proc/proc1 3000 

i need solve this:

/proc/proc1 1000 3000 /proc/proc2 2000 

the path (/proc/proc*) can include spaces likes: /proc/proc hello/foo

here wrote handle /proc/ , pids, i'm stuck on problem..

#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; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -