getting file words as pattern matching

Sir,

I want to check for the repation of a user address in a file i used || as my delimiter and want to check repetaip0n of the address that is mailid and then i have to use IMAP and all.

How can i do this...

 I am in linux ...and my file is linux file.

                 Thanks,
                 ArunKumar

are you sure that you are going to be using C programming to match the usernames? I think shell scripting will be so much easier... You can use grep/awk to match for usernames and mail ids.

No i want to use by c..please help

If you have to search for a word in a file, then you can read the file line by line - you can use fgets to read the file. Use strstr / strcmp to match/search specific words.

ok that is ok take this a s a aituation..

a@yahoo.com b@rediff.com
c@unix.com d@linux.com

There are two lines in the file if i want to find the b@rediff.com when i read file line by line it is not possible to use strstr right...i have to split the line by space..

Is there is any way that ew can read file by space by space as we doing fgets to read line by if so how can we do that..

                                       Thanks,
                                       ArunKumar

read file line by line and use strtok(), if user names are seperated by space. and then use strcmp() with each token to compare user names.